0

Is there a way to publish a message to all the partitions? I am using kafka-python==1.4.3.

Understood from the documentation that

key (optional) – a key to associate with the message. Can be used to determine which partition to send the message to. If partition is None (and producer’s partitioner config is left as default), then messages with the same key will be delivered to the same partition (but if key is None, partition is chosen randomly). Must be type bytes, or be serializable to bytes via configured key_serializer.

but was not able to find any clue if the message can be published to all partitions.

Yogeswaran
  • 357
  • 1
  • 13

1 Answers1

0

Understood that there is no direct API but it can be achieved by combining two calls.

partitions_for(topic) - Returns set of all known partitions for the topic.

send(topic, value=None, key=None, headers=None, partition=None, timestamp_ms=None) - Publish a message to a topic.
Yogeswaran
  • 357
  • 1
  • 13