Class BatchReceivePolicy
- All Implemented Interfaces:
Serializable
Consumer.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
means Consumer.batchReceive()
will waiting for 100ms whether or not there is enough messages.
Note:
Must specify messages limitation(maxNumMessages, maxNumBytes) or wait timeout.
Otherwise, Messages
ingest Message
will never end.
- Since:
- 2.4.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder of BatchReceivePolicy. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BatchReceivePolicy
static final BatchReceivePolicy
Default batch receive policy. -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchReceivePolicy.Builder
builder()
int
int
long
boolean
toString()
void
verify()
-
Field Details
-
DEFAULT_POLICY
Default batch receive policy.Max number of messages: no limit Max number of bytes: 10MB Timeout: 100ms
-
DEFAULT_MULTI_TOPICS_DISABLE_POLICY
-
-
Method Details