Class BatchingPolicy
java.lang.Object
org.apache.pulsar.client.api.v5.config.BatchingPolicy
Configuration for producer message batching.
When batching is enabled, the producer groups multiple messages into a single broker request to improve throughput. A batch is flushed when any of the configured thresholds is reached.
Construct via builder(), or use ofDisabled() to opt out.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchingPolicy.Builderbuilder()booleanenabled()intmaxSize()static BatchingPolicyBatching disabled.
-
Method Details
-
enabled
public boolean enabled()- Returns:
- whether batching is enabled
-
maxPublishDelay
- Returns:
- the maximum time to wait before flushing a batch
-
maxMessages
public int maxMessages()- Returns:
- the maximum number of messages in a single batch
-
maxSize
- Returns:
- the maximum size of a single batch
-
ofDisabled
Batching disabled.- Returns:
- a
BatchingPolicywith batching disabled
-
builder
- Returns:
- a new builder for constructing a
BatchingPolicy
-