0
votes

In the example here: https://github.com/confluentinc/kafka-streams-examples/blob/5.1.0-post/src/main/java/io/confluent/examples/streams/PageViewRegionExample.java there's a KStream and KTable join.

And in the driver https://github.com/confluentinc/kafka-streams-examples/blob/5.1.0-post/src/main/java/io/confluent/examples/streams/PageViewRegionExampleDriver.java it sends users to a users topic, and page views to a page views topic (with the user inside the view).

However, in the example, we're first creating a KStream for the page views topic, then a KTable for the user profiles topic, and then joining them. Assuming the application doesn't just load every piece of data from both streams before executing the join, what happens if a view comes and the user profile hasn't been saved to the table yet?

1

1 Answers

0
votes

If KTable will not be load before events in stream appear leftJoin will have null at KTable site, and join will not return joinedValue.

Suggestion is to start Kafka Streams Application, load data into topic, that is used by KTable (by some producer) and than start emitting event to stream topic.

Interesting presentation about join in Kafka Streams was in Kafka Summit (San Francisco 2018), video can be found: View Video and Slides Zen and the Art of Streaming Joins—The What, When and Why