Package | Description |
---|---|
com.tencentcloudapi.tdmq.v20200217 | |
com.tencentcloudapi.tdmq.v20200217.models |
Modifier and Type | Method and Description |
---|---|
ReceiveMessageResponse |
TdmqClient.ReceiveMessage(ReceiveMessageRequest req)
当前 ReceiveMessage 接口只支持 Partitioned 类型的 Topic。该接口用于接收发送到指定 Partitioned Topic 中的消息,当 Partitioned Topic 中没有消息但还去尝试调用该接口时,会抛出 ReceiveTimeout 的异常。
如何使用 BatchReceivePolicy:
BatchReceive 接口提供了如下三个参数:
● MaxNumMessages: 即每次使用 BatchReceive 的时候,最多一次Receive接口返回多少条消息。
● MaxNumBytes:即每次使用 BatchReceive 的时候,最多一次Receive接口返回多大内容的消息,单位是:bytes。
● Timeout:即每次使用 BatchReceive 的时候,最多一次 Receive 接口的超时时间是多久,单位是:MS。
默认如果上述三个参数都不指定,即关闭 BatchReceive 的特性。如果三个参数中的任意一个参数指定的数值大于 0,即开启 BatchReceive。BatchReceive 的结束条件为到达上述三个参数中任意一个指定的阈值。
注意:MaxNumMessages 和 MaxNumBytes 每一次接收的最大消息同时受限于 ReceiveQueueSize 的大小,如果 ReceiveQueueSize 的大小设置为 5,MaxNumMessages 设置为10,那么一次 BatchReceive 接收的最多的消息是 5条,而不是10条。
BatchReceivePolicy 的接口会一次性返回多条消息:
1.
|
Constructor and Description |
---|
ReceiveMessageResponse(ReceiveMessageResponse source)
NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
|
Copyright © 2022. All rights reserved.