This topic describes the parameters that you must configure when you use the Community Edition of SDK for Java to connect to ApsaraMQ for RocketMQ.
Common parameters
Parameter | Description |
NAMESRV_ADDR | The TCP endpoint. You can obtain the endpoint on the Instance Details page in the ApsaraMQ for RocketMQ console. |
AccessKey | The AccessKey ID that is used for authentication. For information about how to obtain an AccessKey ID, see Create an AccessKey pair. |
SecretKey | The AccessKey secret that is used for authentication. For information about how to obtain an AccessKey secret, see Create an AccessKey pair. |
AccessChannel | Specifies whether to use the message trace feature on the cloud. If you want to use the message trace feature on the cloud, set this parameter to CLOUD. |
Parameters for message sending
Parameter | Description |
producerGroup | The ID of the producer group. If multiple producers belong to the same application and send the same messages, the producers are considered to belong to the same group. You can obtain the ID of a producer group in the ApsaraMQ for RocketMQ console. For more information, see Terms. |
sendMsgTimeout | The timeout period for sending messages. Unit: milliseconds. |
compressMsgBodyOverHowmuch | Specifies the body size threshold for a message to be compressed. If the body size of a message exceeds the threshold, the message is compressed and then decompressed upon reception by the consumer. Default value: 4. Unit: KB. |
retryTimesWhenSendFailed | The maximum number of retries that can be performed on a message if the message fails to be sent. This parameter takes effect only for messages that are sent in synchronous mode. |
maxMessageSize | The maximum message size that is specified by the client. If the size of a message exceeds the value specified by this parameter, an error is reported. The broker also imposes a limit on the message size. This parameter must be used together with the corresponding parameter on the broker. Default value: 4. Unit: MB. |
Parameters for message subscription
Parameter | Description |
consumerGroup | The ID of the consumer group. If multiple consumers belong to the same application, subscribe to the same messages, and use the same message consumption logic, the consumers are considered to belong to the same group. You can obtain the ID of a consumer group in the ApsaraMQ for RocketMQ console. For more information, see Terms. |
consumeFromWhere | The offset from which messages are consumed after a consumer group is started. By default, messages are consumed from the latest offset. |
consumeThreadMin | The minimum number of threads in the consumer thread pool. Default value: 20. |
consumeThreadMax | The maximum number of threads in the consumer thread pool. Default value: 20. The maximum number of threads must be consistent with the minimum number of threads. |
consumeConcurrentlyMaxSpan | The maximum offset span that is allowed when messages are concurrently consumed in a queue. Valid values: 1 to 65535. Default value: 2000. |
pullThresholdForQueue | The maximum number of messages that can be cached in a local queue when messages are pulled. Valid values: 1 to 65535. Default value: 1000. |
pullThresholdSizeForQueue | The total size of messages that can be cached in a local queue when messages are pulled. Valid values: 1 to 1024. Default value: 100. Unit: MB. |
maxReconsumeTimes | The maximum number of retries. Default value: 16. |
suspendCurrentQueueTimeMillis | The minimum time interval between two consecutive retries of ordered messages. Valid values: 10 to 30000. Default value: 1000. Unit: milliseconds. |