All Products
Search
Document Center

ApsaraMQ for RocketMQ:Step 2: Create resources

Last Updated:Jul 08, 2024

Before you use an SDK to send and receive messages, you must create resources in ApsaraMQ for RocketMQ, including ApsaraMQ for RocketMQ instances, topics, and consumer groups. You must also obtain the endpoints of the instances. When you use the SDK to send and receive messages, you must specify the information about the resources in the SDK code.

Before you start

Background information

ApsaraMQ for RocketMQ allows you to create resources in the ApsaraMQ for RocketMQ console or by calling API operations. This topic describes how to create resources in the ApsaraMQ for RocketMQ console.

If you want to create resources by calling API operations, refer to the following topics:

Limits

  • Regions

    Make sure that the ApsaraMQ for RocketMQ instance resides in the same region as the VPC and vSwitch that you created in the "Before you start" section of this topic.

  • Naming conventions

    For information about the naming conventions of ApsaraMQ for RocketMQ instances, topics, and consumer groups, see Quotas and limits.

  • Message types of topics

    The message type of a topic must be consistent with the type of message that the topic sends and receives. For example, if you create a topic that is used to send and receive normal messages, you can use it to send and receive only normal messages. For more information, see Usage notes.

Create an instance

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou).

  3. On the Instances page, click Create Instance. In the Create Message Queue for Apache RocketMQ Instance panel, set the Instance Version parameter to V5.0 and configure the Billing Method parameter. Then, click OK.

    ApsaraMQ for RocketMQ supports the following billing methods:

    • Subscription: An upfront payment is required based on the computing specification and subscription duration (in months) that you select for an instance.

    • Pay-as-you-go: Fees are post-paid based on the computing specification that you select for an instance and the actual usage duration (in hours) of the instance.

    For information about the billable items and scenarios of different billing methods, see Overview.

  4. In the buy panel that appears, select the specifications of the instance and click Buy Now. Then, follow the on-screen instructions to complete the payment.

    The following table provides an example on how to configure the parameters in the buy panel. For information about the specifications that are displayed in the buy panel, see Instance selection.

    Parameter

    Example

    Primary Edition

    Standard Edition

    Sub-category Edition

    Cluster High-availability Edition (Recommended for Production Environments)

    Computing Specification

    rmq.s2.2xlarge

    VPC ID

    vpc-bp1cg09dua6sgh0******

    The value of this parameter is the ID of the VPC that you created in the "Before you start" section of this topic.

    Important

    After you create an ApsaraMQ for RocketMQ instance, you cannot change the VPC in which the instance is deployed. If you want to change the VPC in which an ApsaraMQ for RocketMQ instance is deployed, you must release the instance and purchase a new instance.

    VSwitch ID

    vsw-bp1vqb0p9nz3irz******

    The value of this parameter is the ID of the vSwitch that you created in the "Before you start" section of this topic.

    Important

    After you create an ApsaraMQ for RocketMQ instance, you cannot change the vSwitch with which the instance is associated. If you want to change the vSwitch with which an ApsaraMQ for RocketMQ instance is associated, you must release the instance and purchase a new instance.

    Internet Access

    Disable

    Note

    In this example, the client is connected to the ApsaraMQ for RocketMQ broker in a VPC. By default, Internet access is disabled. If you want to access ApsaraMQ for RocketMQ over the Internet, set this parameter to Enable.

    Resource Group

    In this example, the default resource group is selected.

Obtain the endpoint of an instance

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the TCP Endpoint section of the Instance Details page, view the endpoints of the instance.

    • VPC endpoint: The endpoint that is used to access the ApsaraMQ for RocketMQ instance in a VPC. This is the default endpoint provided by ApsaraMQ for RocketMQ.

    • Public endpoint: The endpoint that is used to access the ApsaraMQ for RocketMQ over the Internet. The public endpoint is displayed only if you enable Internet access.

Obtain the username and password of an instance

Note

In this example, intelligent authentication is used to describe how to obtain the username and password of an ApsaraMQ for RocketMQ instance.

If you want to use access control list (ACL)-based access authentication, you must create an ACL user, grant the required permissions to the ACL user, and obtain the username and password of the ACL user. For more information, see User authentication.

When you connect a client to an ApsaraMQ for RocketMQ broker, whether to specify the username and password of the instance is determined by the access method.

  • If you access the ApsaraMQ for RocketMQ broker over the Internet, you must specify the username and password of the instance.

  • If you access the ApsaraMQ for RocketMQ broker in a VPC, you do not need to specify the username or password of the instance. The system intelligently identifies the user based on the VPC endpoint.

  1. On the Instances page, click the name of the instance that you want to manage.

  2. On the Basic Information tab of the Instance Details page, view the Username and Password parameters.

Create a topic

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the left-side navigation pane, click Topics. On the Topics page, click Create Topic.

  3. In the Create Topic panel, enter a topic name and description, set the Message Type parameter to Normal Message, and then click OK.

Create a consumer group

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the left-side navigation pane, click Groups. On the Groups page, click Create Group.

  3. In the Create Group panel, configure the Group ID parameter and click OK. You can use the default values for other parameters in the panel.

What to do next

Step 3: Use SDKs to send and receive messages