Reviewed-by: Liudmila Denisova <ldenisov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: chenjunjie <chenjunjie@huawei.com> Co-committed-by: chenjunjie <chenjunjie@huawei.com>
13 KiB
Accessing RocketMQ on a Client (Without SSL)
This document describes how to access a RocketMQ instance with SSL disabled on the Linux CLI. When SSL is disabled, data is transmitted in plaintext between a client and a RocketMQ instance at high performance.
Prerequisites
- A RocketMQ instance with PLAINTEXT or PERMISSIVE for encryption has been created.
- The network between the client and the RocketMQ instance has been established. For details about network requirements, see RocketMQ Network Connection Conditions.
- A RocketMQ instance has been created and its connection address has been obtained.The connection address can be obtained from Basic Information > Connection on the RocketMQ console.
- If the client uses TCP, obtain Instance Address (Private Network) or Instance Address (Public Network).
- If the client uses gPRC, obtain gRPC Connection Address or gRPC Connection Address (Public Network).
- Security group rules have been configured.
- A topic has been created. The topic name has been obtained and publish and subscribe permissions are granted.
- Java Development Kit 1.8.111 or later has been installed on the client server, and related environment variables have been configured.
- The client server must be able to access the Internet to download the sample software package.
Accessing the Instance with CLI
- Log in to the client server using SSH.
- Download the rocketmq-tutorial software package.
wget https://dms-demos.obs.eu-de.otc.t-systems.com/rocketmq-tutorial.zip
- Decompress the rocketmq-tutorial package.
unzip rocketmq-tutorial.zip
- (Optional) If ACL is enabled for the RocketMQ instance, authentication is required when you run the mqadmin command.Switch to the directory where the decompressed software package is stored and add the following content to the conf/tools.yml file:
accessKey:******* secretKey:*******
accessKey and secretKey are the username and secret key set on the Users page of the console. For details, see Creating a User.
- Go to the rocketmq-tutorial/bin directory.
cd rocketmq-tutorial/bin
- Produce normal messages using the sample project.
sh mqadmin sendMessage -n "${Connection address}" -t ${Topic name} -p "Message content"
Table 1 Message production parameters Parameter
Description
Example Value
Connection address
Connection address of the RocketMQ instance, which is obtained from Prerequisites.
11.xxx.xxx.89:8200;11.xxx.xxx.144:8200 (public connection addresses as an example, private port is 8100)
Topic name
Name of a topic created in the RocketMQ instance, which is obtained from Prerequisites.
topic-test
Message content
The message content is custom.
The maximum message size supported by RocketMQ is 4 MB. This limit cannot be modified.
hello rocketmq
Run the following command with the values obtained in Table 1 to produce a normal message:
sh mqadmin sendMessage -n "11.xxx.xxx.89:8200;11.xxx.xxx.144:8200" -t topic-test -p "hello rocketmq"
The message is produced when the information in the red box shown in the following figure is displayed.
- Consume normal messages using the sample project.
sh mqadmin consumeMessage -n "${Connection addresses}" -t ${Topic name}
Run the following command with the values obtained in Table 1 to consume normal messages:
sh mqadmin consumeMessage -n "11.xxx.xxx.89:8200;11.xxx.xxx.144:8200" -t topic-test
The message is consumed when the information in the red box shown in the following figure is displayed.
To stop consuming messages, press Ctrl+C to exit.
- Create messages with traces using the sample project.
sh mqadmin sendMessage -n "${Connection addresses}" -t ${Topic name} -p "Message content" -m true
Run the following command with the values obtained in Table 1 to produce messages with traces:
sh mqadmin sendMessage -n "11.xxx.xxx.89:8200;11.xxx.xxx.144:8200" -t topic-test -p "hello rocketmq" -m true
The message is produced when the information in the red box shown in the following figure is displayed.
- Retrieve messages and send the message traces using the sample project.
sh mqadmin consumeMessage -n "${Connection addresses}" -t ${Topic name} -m true
Run the following command with the values obtained in Table 1 to consume messages with traces:
sh mqadmin consumeMessage -n "11.xxx.xxx.89:8200;11.xxx.xxx.144:8200" -t topic-test -m true
The message is consumed when the information in the red box shown in the following figure is displayed.
To stop consuming messages, press Ctrl+C to exit.



