Reputation: 4990
I am trying to send messages to two different kafka topics using the KafkaSender of Reactor Kafka.
By two different kafka topics, I mean: There is a topic called "first_topic" in cluster kafka-first-broker.com:9092 Then, there is another topic called "another_topic", in another cluster, not the same as above, called kafka-another-broker-not-the-same-as-above.com:9093
However, it seems the send
method of reactor kafka only supports one destination
I tried using the send method with a comma-separated list of (two topics)
SenderRecord.create(new ProducerRecord<>("first_topic,another_topic", null, mymessage), mymessage)
I was expecting this to be sent to two different topics, but it can only be sent to one.
How can I leverage Reactor Kafka KafkaSender API to send messages to two different topics situated in two different Kafka clusters?
Upvotes: 0
Views: 34
Reputation: 191738
There's only one ProducerConfig shared across the senders. There's only one cluster represented per ProducerConfig
You'll need to construct a new instance of both, first.
Upvotes: 2