ApsaraMQ for RocketMQ provides a C/C++ SDK for sending and consuming messages. The following tables describe the connection, producer, and consumer parameters.
Connection parameters
Configure these parameters to connect to your ApsaraMQ for RocketMQ instance.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
NAMESRV_ADDR | String | Yes | None | The TCP endpoint of your ApsaraMQ for RocketMQ instance. Get this value from the Instances page in the ApsaraMQ for RocketMQ console. |
AccessKey | String | Yes | None | The AccessKey ID for identity authentication. To create one, see Create an AccessKey pair. |
SecretKey | String | Yes | None | The AccessKey secret for identity authentication. To create one, see Create an AccessKey pair. |
OnsChannel | String | No | ALIYUN | The user channel. Valid values: ALIYUN (default), CLOUD (for CloudTmall users). |
Producer parameters
Configure these parameters when sending messages.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ProducerId | String | Yes | None | The group ID of the producer, created in the ApsaraMQ for RocketMQ console. For more information, see Terms. |
SendMsgTimeoutMillis | Integer | No | 3000 | The timeout for sending a message, in milliseconds. |
shardingKey | String | Conditional | None | The sharding key for ordered messages. Required only when sending ordered messages. Messages with the same shardingKey are delivered to consumers in the order they were sent. |
Consumer parameters
Configure these parameters when consuming messages.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ConsumerId | String | Yes | None | The group ID of the consumer, created in the ApsaraMQ for RocketMQ console. For more information, see Terms. |
MessageModel | String | No | CLUSTERING | The consumption model that determines how messages are distributed within a consumer group. Valid values: CLUSTERING (default) -- each message is delivered to only one consumer in the group, for load-balanced workloads. BROADCASTING -- each message is delivered to all consumers in the group, for scenarios where every instance must process every message. |
ConsumeThreadNums | Integer | No | 20 | The number of consumption threads on each consumer instance. |
Related topics
该文章对您有帮助吗?