I've implemented a KTable and a KStream join in my application and expecting output messages in the following cases;
- A new message in KStream and there's a matching record in the KTable
- An updated message came in KStream and there's a matching record in the KTable
- When there's an update on a KTable record
I've been observing that my application does 1 and 2 as expected but not 3.
Is there any advice that I can get to achieve point 3?
Thanks!
You are looking for a table to table join. This triggers an output message when a new record arrives on either topic.
Start by ensuring that records you want to join across topics have the same key and are co-partitioned. Then read both topics as KTables.
Finally, perform a join on both tables
https://docs.confluent.io/platform/current/streams/javadocs/javadoc/org/apache/kafka/streams/kstream/KTable.html#join-org.apache.kafka.streams.kstream.KTable-org.apache.kafka.streams.kstream.ValueJoiner-