C/C++ SDK parameters

更新时间:
复制 MD 格式

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.

ParameterTypeRequiredDefaultDescription
NAMESRV_ADDRStringYesNoneThe TCP endpoint of your ApsaraMQ for RocketMQ instance. Get this value from the Instances page in the ApsaraMQ for RocketMQ console.
AccessKeyStringYesNoneThe AccessKey ID for identity authentication. To create one, see Create an AccessKey pair.
SecretKeyStringYesNoneThe AccessKey secret for identity authentication. To create one, see Create an AccessKey pair.
OnsChannelStringNoALIYUNThe user channel. Valid values: ALIYUN (default), CLOUD (for CloudTmall users).

Producer parameters

Configure these parameters when sending messages.

ParameterTypeRequiredDefaultDescription
ProducerIdStringYesNoneThe group ID of the producer, created in the ApsaraMQ for RocketMQ console. For more information, see Terms.
SendMsgTimeoutMillisIntegerNo3000The timeout for sending a message, in milliseconds.
shardingKeyStringConditionalNoneThe 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.

ParameterTypeRequiredDefaultDescription
ConsumerIdStringYesNoneThe group ID of the consumer, created in the ApsaraMQ for RocketMQ console. For more information, see Terms.
MessageModelStringNoCLUSTERINGThe 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.
ConsumeThreadNumsIntegerNo20The number of consumption threads on each consumer instance.

Related topics