Are messages lost if the machine on which a consumer group runs fails and restarts?
Can I leave the parameter that is used to specify tags empty when I subscribe to messages?
How do I set the consumer offset when I create a consumer group to subscribe to an old topic?
How do I troubleshoot the issue that connection fails the first time I connect my client to the broker?
Check whether the following configurations are valid:
Check whether the endpoint is correctly specified. You can obtain the endpoint on the Instance Details page in the ApsaraMQ for RocketMQ console.
Run the telnet Domain name in the endpoint Port number command to check the network connectivity.
If your application is deployed on an on-premises machine or if you want to access ApsaraMQ for RocketMQ across regions but cannot build a network by using Cloud Enterprise Network (CEN), you must use a public endpoint to access the ApsaraMQ for RocketMQ instance. If you use a public endpoint to access an ApsaraMQ for RocketMQ instance, you are charged for outbound Internet traffic. For more information, see Internet access fees for ApsaraMQ for RocketMQ 4.x instances or Internet access fees for ApsaraMQ for RocketMQ 5.x instances.
If your application is deployed on an Alibaba Cloud Elastic Compute Service (ECS) instance, you can use a virtual private cloud (VPC) endpoint to access the ApsaraMQ for RocketMQ instance in a VPC. In this case, you must make sure that the ECS instance resides in the same region as the ApsaraMQ for RocketMQ instance.
If you enable the Internet access feature for an ApsaraMQ for RocketMQ 5.0 instance, check whether an IP address whitelist is configured. If you enable the Internet access feature, you can access ApsaraMQ for RocketMQ from any IP address by default. If you specify an IP address whitelist, you can access ApsaraMQ for RocketMQ only from the IP addresses in the whitelist.
Check whether the topic name is correctly specified. Make sure that the topic name does not contain extra spaces or special characters and that the topic is created in the ApsaraMQ for RocketMQ console in advance.
Check whether the username and password are correctly specified.
ApsaraMQ for RocketMQ 5.0 instances: You must specify the username and password of the instance. You can obtain the instance username and password on the Instance Details page in the ApsaraMQ for RocketMQ console.
ApsaraMQ for RocketMQ 4.0 instances: You must specify the AccessKey ID and AccessKey secret of the Alibaba Cloud account or Resource Access Management (RAM) user. If you use a RAM user, make sure that the RAM user is granted the required permissions. For information about how to obtain an AccessKey pair, see Create an AccessKey pair.
What do I do if subscriptions are inconsistent?
Log on to the ApsaraMQ for RocketMQ console. On the Groups page, view the subscriptions and consumers of the consumer group in which the issue occurs. Then, modify the subscription code of the consumers whose subscriptions are inconsistent.
How do I handle accumulated messages?
Messages may be accumulated due to the following causes:
An exception occurred in the message consumption logic.
Traffic spikes occurred in the application that produces messages. In this case, the rate of message production far exceeds the rate of message consumption and message accumulation is caused.
The processing duration of the downstream services on which consumers rely is prolonged, and consumption threads are blocked.
Insufficient consumption threads cause a low level of consumption concurrency. As a result, message consumption lags behind message production.
To determine the cause of an exception, you must check the logs or stack information of the client. For more information, see How do I handle accumulated messages?
What do I do if a consumer cannot consume messages?
Log on to the ApsaraMQ for RocketMQ console. On the Groups page, check whether the consumer is online and whether the client connection is normal. If the client is not connected, check the client logs and troubleshoot the exception based on the error.
Check whether the subscriptions are consistent. If the subscriptions are inconsistent, find the consumer client whose subscriptions are inconsistent based on the distribution of the subscriptions and modify the subscription code of the consumer client.
Are messages lost if the machine on which a consumer group runs fails and restarts?
ApsaraMQ for RocketMQ provides persistent subscriptions. If a consumer group goes offline or a consumption exception occurs, messages are not lost. After the consumer client is reconnected to the broker, a consumer can consume messages from the offset where the consumer left off before the client was disconnected.
Can I leave the parameter that is used to specify tags empty when I subscribe to messages?
No. If you leave the parameter that is used to specify tags empty when you subscribe to messages, consumers cannot consume messages. If you want to subscribe to all messages in a topic, you must set the parameter to *
. Sample code:
String topic = "Your Topic";
// Use tags to filter messages and subscribe to all messages.
FilterExpression filterExpression = new FilterExpression("*", FilterExpressionType.TAG);
pushConsumer.subscribe(topic, filterExpression);
For more information, see Tag-based filtering.
How do I set the consumer offset if I create a consumer group to subscribe to an existing topic?
When you create a consumer group, you cannot set the consumer offset, regardless of whether you subscribe to a new topic or an existing topic. If a consumer is started for the first time, consumption starts from the earliest stored message by default.
If a consumer is not started for the first time, you can reset the consumer offset in the ApsaraMQ for RocketMQ console. For more information, see Reset a consumer offset.
What do I do if messages are accumulated in a group even though online consumers did not consume messages?
Check the method used by the group to which the consumers belong to subscribe to the topic. If the group subscribes to the topic by using a message filtering method, messages that do not meet the filtering conditions are accumulated. In this case, message accumulation is normal. For more information, see Message filtering.
The following items describe how to calculate the number of accumulated messages when you use SQL filtering and tag-based filtering to filter messages:
SQL filtering: Number of accumulated messages = Number of ready messages + Number of inflight messages - Number of messages that do not meet the filtering conditions
Tag-based filtering: Number of accumulated messages = (Number of ready messages + Number of inflight messages) × Percentage of messages that match the tags
Percentage of messages that match the tags = Number of messages that match the tags in the sample/Total number of sampled messages
What do I do if the dashboard displays a large number of accumulated messages but the consumer client displays that the messages are consumed?
Check whether you use a Remoting SDK and specify broadcasting consumption as the consumption method on the consumer client. An ApsaraMQ for RocketMQ broker determines message accumulation based on the consumer offset. In the broadcasting consumption mode, consumer offsets are maintained on the client. As a result, you can view message accumulation on the dashboard.
Check whether you use SQL filtering or tag-based filtering on the consumer client. If you use SQL filtering or tag-based filtering, messages that do not meet the filtering conditions are considered accumulated messages.