0

In my current project, I implemented a Kafka consumer using the poll mechanism directly instead of @KafkaListener. My question is: Can I dynamically create both a request and a reply topic in the runtime by parsing the request body data? If such a thing is possible how can I configure ReplyingKafkaTemplate in my Kafka config class without giving a response topic in KafkaMessageListenerContainer?

Mel
  • 13
  • 5
  • can you elaborate on your question ? What is that you are trying to achieve . Please provide some examples or pseudo images of your requirement – Umeshwaran Jan 21 '22 at 15:07
  • Image for the flow-> https://ibb.co/5KRZJ2Z At step 2, I will create request and response topics dynamically with the data that I got from step 1 in the request body. Basically, the destination server name will be topic names (From the image request topic will be "serverB" and response topic will be "serverA"). Since I can only get the destination info in runtime via the request body in step 1, I will need to be able to create the ReplyingKafkaTemplate bean without using the topic name. – Mel Jan 21 '22 at 16:53
  • Not sure I understand the question, but yes, an `AdminClient` instance can be used to create topics at runtime – OneCricketeer Jan 21 '22 at 19:00

0 Answers0