I think my question is simple but I am unable to figure it out,
#1: I have a db table that has different vendors with their kafka topic entry
VENDOR TOPIC
-----------------------
Paytm PaytmTestTopic
Phonepe PhonePeTestTopic
GPay GpayTestTopic
Roger RogerTestTopic
there are more entries.
#2: I have a KafkaStream Listening to a transaction topic.
final StreamsBuilder builder = new StreamsBuilder();
final KStream<String, String> stream = builder.stream("payment_txn_topic");
#3: stream has a deserializer, factory and chunks serializer to transform the output
stream.transformValues(eventDeserializer)
.flatMapValues(chunkFactory)
.transformValues(chunkSerializer)
.to("");
4: I need to have the topic name dynamically extracted I know how to use TopicNameExtractor to get the topic name and pass it to .to() for output.
But here is my use-case:
My Event will be somewhat {"modeList":[{"mode":"Paytm"}, {"mode":"Roger"}]}
so now I need the extractor so that it can subscribe both "PaytmTestTopic" and "RogerTestTopic" i.e. depending the modes in event as list.
Q1: As we can return only one topic name from TopicNameExtractor, how can I do it for multiple met conditions in single event ?
Q2: Anyway to use Extractor based on transformed data to be sent ? as TopicNameExtractor works on received event.
Q3: Can I use dynamic branches and/or KTable to achieve it?
Any help will be much appreciated, Thanks in advance.