In Message Queue, the production and consumption of messages need to be in the form of topic subscription, so the user first needs to create a message topic, sends the message to a specified message topic, and the consumer consumes the message by subscribing to the consumer body.
- You have created a JD Cloud account and finished real-name verification. Your account is usable and doesn't exist in the black list. If you don't have an account, please Register, and verify real-name.
- Because the Billing Type of the product is charged by amount, please confirm that your account cannot be overdue.
- By default, users can only create up to 10 topics in one region. If necessary, they can increase the number by opening ticket.
- There is no limit to the number of Consumer Group subscriptions for a topic.
Step 1: Create Consumption Topic
- Sign in to the JD Cloud console, the menu is "Middleware > Message Queue > Topic Management".
- Choose the region of creating resources, and then click Create button to create topic.
- You need to fill in Topic Name, Message Type and Remarks during creating topic.
- The Topic Name must be globally unique, if a name already exists; you are not able to create a Topic Name any more. The topic only contains letters, numbers, hyphens (-), underscores (_), waveforms (~) or sign (+), and the length is 3-64 characters.
- The message type includes unordered messages and global ordered messages.
- Unordered messages: Cannot guarantee first in first out (FIFO) ordered consumption, including general messages and delayed messages.
- Global ordered messages: The production and consumption of messages are carried out according to the publishing order of messages (FIFO).
Step 2: Add Subscription
- In "Topic Management" page, find the topic you want to subscribe, and you can subscribe in the operations.
- To add a subscriber, you need to create / bind an existing Consumer Group ID, select the transport type, and add a tag.
- The Consumer Group ID must be globally unique. If a name already exists, you are not able to create a Consumer Group ID with that name any more. The Consumer Group ID only contains letters, numbers, hyphens (-), underscores (_), and the length is 7~64 characters.
- The relationship between Consumer Group ID and topic is N:M; that is the same Consumer Group ID can subscribe multiple topics, and the same topic can be bound with multiple Consumer Group ID.
- Choose the message type to send, including SDK method and HTTP method.
- Subscriber tag rules: tag is a message subscriber for message filtering, when the subscriber sets the tag, the same tag message can be consumed by the subscriber, if not set the tag, the subscriber does not filter the message. A single subscriber can add up to five tags, a single tag is a string of no more than 64 characters, separated by a ',' sign.
- For message 1, does not have message tag, the subscriber has tag, then the subscriber does not match and will not receive news.
- For message 2, the message has a tag, the subscriber does not have a tag, the message does not need to match when delivered, and all the subscribers can receive the message.
- For message 3, when the message and the subscriber both have a tag, the two matches, and can receive the message.
- For Message 4, the message does not have a tag; the subscriber does not have a tag either. After delivery, all subscribers can receive the message.
Step 3: Create AccessKey and SecretKey
When calling the SDK or openAPI of Message Queue to send, consume, and manage messages, you need to verify the user’s identity information, that is, you need to create AccessKey and SecretKey in the console.
Apply for AccessKey and SecretKey key pairs (AK/SK for short) on AccessKey management pages under account management of JD Cloud User Center.
AK / SK information should be kept properly, if lost, it may lead illegal users to use this information to manipulate your resources in the cloud, cause your data and property losses. AK / SK key pairs are allowed to be enabled, disabled, and can be used to call the OpenAPI when enabled, but cannot be used to call the OpenAPI when disabled.