All Products
Search
Document Center

ApsaraMQ for RocketMQ:Step 2: Create resources

Last Updated:Nov 27, 2023

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.

For information about how to call API operations to create resources, see List of operations by function.

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 instances, topics, and consumer groups in ApsaraMQ for RocketMQ, see Usage 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 for topics.

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

    High-availability Cluster 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 with which the instance is associated. If you want to change the VPC with which an ApsaraMQ for RocketMQ instance is associated, 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

    Select Default Resource Group.

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, you can view the endpoint 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.

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 that appears, 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 that appears, 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