This recipe shows how to write to Kafka with Apache Beam.
Writing to Kafka from Apache Beam
Getting ready
To install Apache Beam, follow the instructions at: https://beam.apache.org/get-started/quickstart-py/.
How to do it...
The following code shows how to write a Beam pipeline to write to Kafka. The example illustrates various options for configuring the Beam sink:
PCollection<KV<Long, String>> kvColl = ...; kvColl.apply(KafkaIO.write() .withBootstrapServers("broker_1:9092, broker_2:9092") .withTopic("destination...