When the client first connects to the ApsaraMQ for RocketMQ broker, the connection fails and messages cannot be sent, how do I fix the issue?

Check whether the following configurations are valid:
  • Check whether the endpoint is correctly specified. You can obtain the endpoint from the Instance Details page in the ApsaraMQ for RocketMQ console.
  • Run the telnet Endpoint domain name Port command to check the network connectivity.
    • If your application is deployed on an on-premises device 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 ApsaraMQ for RocketMQ, you are charged for Internet outbound traffic. For more information, see Internet traffic fee for ApsaraMQ for RocketMQ 4.x instances or Internet traffic fee for ApsaraMQ for RocketMQ 5.x instances.
    • If your application is deployed on an Elastic Compute Service (ECS) instance, you can use a virtual private cloud (VPC) endpoint to access the ApsaraMQ for RocketMQ instance. 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 a ApsaraMQ for RocketMQ 5.0 instance, confirm whether an IP address whitelist is configured. By default, all IP addresses can access ApsaraMQ for RocketMQ. If an IP address whitelist is configured, only the IP addresses in the whitelist can access ApsaraMQ for RocketMQ.
  • Check whether the topic name is valid. The topic name cannot contain extra spaces or special characters. Check whether the topic exists in the ApsaraMQ for RocketMQ console.
  • Check whether the username and password are valid.
    • 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 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 the AccessKey ID and AccessKey secret, see Create an AccessKey pair.

Why does an error that indicates the message is invalid appears when I send a message?

Possible causes:
  • The message body is empty.
  • The message body exceeds the size limit. The following items describe the maximum size of a message body in different instances:
    • ApsaraMQ for RocketMQ 5.0 instances:

      A message cannot exceed 4 MB in size.

    • ApsaraMQ for RocketMQ 4.0 instances:
      • Normal message or ordered message: 4 MB
      • Transactional message, scheduled message, or delayed message: 64 KB
      Note The size of attributes for a message cannot exceed 16 KB regardless of the message type.