类 BatchReceivePolicy
- java.lang.Object
-
- org.apache.pulsar.client.api.BatchReceivePolicy
-
- 所有已实现的接口:
java.io.Serializable
@Public @Stable public class BatchReceivePolicy extends java.lang.Object implements java.io.Serializable
Configuration for message batch receiveConsumer.batchReceive()Consumer.batchReceiveAsync().Batch receive policy can limit the number and bytes of messages in a single batch, and can specify a timeout for waiting for enough messages for this batch.
This batch receive will be completed as long as any one of the conditions(has enough number of messages, has enough of size of messages, wait timeout) is met.
Examples: 1.If set maxNumMessages = 10, maxSizeOfMessages = 1MB and without timeout, it means
Consumer.batchReceive()will always wait until there is enough messages. 2.If set maxNumberOfMessages = 0, maxNumBytes = 0 and timeout = 100ms, it meansConsumer.batchReceive()will waiting for 100ms whether or not there is enough messages.Note: Must specify messages limitation(maxNumMessages, maxNumBytes) or wait timeout. Otherwise,
MessagesingestMessagewill never end.- 从以下版本开始:
- 2.4.1
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classBatchReceivePolicy.BuilderBuilder of BatchReceivePolicy.
-
字段概要
字段 修饰符和类型 字段 说明 static BatchReceivePolicyDEFAULT_POLICYDefault batch receive policy.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static BatchReceivePolicy.Builderbuilder()intgetMaxNumBytes()intgetMaxNumMessages()longgetTimeoutMs()java.lang.StringtoString()voidverify()
-
-
-
字段详细资料
-
DEFAULT_POLICY
public static final BatchReceivePolicy DEFAULT_POLICY
Default batch receive policy.Max number of messages: no limit Max number of bytes: 10MB Timeout: 100ms
-
-
方法详细资料
-
verify
public void verify()
-
getTimeoutMs
public long getTimeoutMs()
-
getMaxNumMessages
public int getMaxNumMessages()
-
getMaxNumBytes
public int getMaxNumBytes()
-
builder
public static BatchReceivePolicy.Builder builder()
-
toString
public java.lang.String toString()
- 覆盖:
toString在类中java.lang.Object
-
-