Skip to content

Commit 2a8819d

Browse files
Add documents for the batching arguments when creating producer (#205)
1 parent d1727cf commit 2a8819d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pulsar/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,20 @@ def create_producer(self, topic,
670670
671671
SNAPPY is supported since Pulsar 2.4. Consumers will need to be at least at that release in order to
672672
be able to receive messages compressed with SNAPPY.
673+
batching_enabled: bool, default=False
674+
When automatic batching is enabled, multiple calls to `send` can result in a single batch to be sent to the
675+
broker, leading to better throughput, especially when publishing small messages.
676+
All messages in a batch will be published as a single batched message. The consumer will be delivered
677+
individual messages in the batch in the same order they were enqueued.
678+
batching_max_messages: int, default=1000
679+
When you set this option to a value greater than 1, messages are queued until this threshold or
680+
`batching_max_allowed_size_in_bytes` is reached or batch interval has elapsed.
681+
batching_max_allowed_size_in_bytes: int, default=128*1024
682+
When you set this option to a value greater than 1, messages are queued until this threshold or
683+
`batching_max_messages` is reached or batch interval has elapsed.
684+
batching_max_publish_delay_ms: int, default=10
685+
The batch interval in milliseconds. Queued messages will be sent in batch after this interval even if both
686+
the threshold of `batching_max_messages` and `batching_max_allowed_size_in_bytes` are not reached.
673687
max_pending_messages: int, default=1000
674688
Set the max size of the queue holding the messages pending to receive an acknowledgment from the broker.
675689
max_pending_messages_across_partitions: int, default=50000

0 commit comments

Comments
 (0)