You can perform the inverse of merging streams with ksqlDB: you can split them. By specifying a predicate on a field in the data, you can route messages to different target streams.
Take the example of a stream of orders for all countries:
You may want to split these orders for country-specific processing:
To do this in ksqlDB, use SQL statements with appropriate predicates:
CREATE STREAM ORDERS_US AS SELECT * FROM ORDERS_COMBINED WHERE SOURCE = 'US'; CREATE STREAM ORDERS_UK AS SELECT * FROM ORDERS_COMBINED WHERE SOURCE = 'UK'; CREATE STREAM ORDERS_OTHER AS SELECT * FROM ORDERS_COMBINED WHERE SOURCE != 'US' AND SOURCE != 'UK';
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.