Hi all,

So let's say I have 2 topics coming that I want to join using KStream#join. I 
set them up like so:

KStreamBuilder builder = new KStreamBuilder();
KStream<String, String> a = builder.stream(TOPIC_A);
KStream<String, String> b = builder.stream(TOPIC_B);

a.join(b, (msgA, msgB) -> msgA + msgB, 
JoinWindows.of(TimeUnit.HOURS.inMillis(1))
  .print();

So this works fine and joins the messages together. But what happens to 
messages that don't find a join partner in the other topic within the window? 
If I get a message in topic A and its partner doesn't occur in B, when and how 
does the message get consumed? Is there a way to write my application so that 
this is caught somehow and handled?

I'm aware that I could use a leftJoin instead, but that would call the merge 
function twice, once with (msgA, null) and the second time with (msgA, msgB). 
I'm trying to find a solution that only calls one or the other.

Is there a way to do this cleanly?

Thanks!
--Michael Thaler

Reply via email to