quix-streams icon indicating copy to clipboard operation
quix-streams copied to clipboard

How to dynamically choose output topics

Open Tobo7 opened this issue 11 months ago • 2 comments

Is it possible to dynamically set output topic of StreamingDataFrame pipeline? I need the output topic name to be derived from message content.

Something like this: sdf.to_topic(lambda value: str(value["target_topic"]))

Native Kafka streams API supports it and its the last thing that keeps me away from using this library. https://developer.confluent.io/confluent-tutorials/dynamic-output-topic/kstreams/

Thank you!

Tobo7 avatar Dec 17 '24 21:12 Tobo7

Hi @Tobo7 , thanks for creating the issue!

What you're asking about makes sense. I'll see what it would take to implement it.

In your case, do you know the expected number of topics upfront? Or is it completely dynamic?

ghost avatar Dec 18 '24 14:12 ghost

In our case, approximately 50-100 topics, but the number will increase in the future.

We collect all DML changes from all database schemas and their tables into one topic. We need to split the messages into multiple topics per schema... so it's highly dynamic.

Thank you for your interest!

Tobo7 avatar Dec 18 '24 17:12 Tobo7

Hi there, we released the support for dynamic topic routing in v3.21.0. Posting it here in case someone is looking for this feature.

ghost avatar Aug 04 '25 09:08 ghost