Hello Michael, sorry for the late reply. If your application logic is the following: 1) output (msgA, msgB) when msgA is under processing and msgB is already available, or 2) output (msgA, null) when processing msgA while msgB for the same topic does not exist, then the pattern you are going after is to "only trigger join with records coming from stream a, but not from stream b". So stream B never triggers join but only used to book keep the received records.
With the DSL stream-stream join, it is not supported since for all inner / left / outer joins both streams' records could trigger the join, and hence you may still see (msgA, msgB) generated after (msgA, null); for stream-table join, today only the stream records will trigger joins against the current state snapshot of the table. So my suggestion would be 1) consider treating KStream b as KTable b, reading from the same topic. 2) is the above is not acceptable, then you may do this one-side-triggering joins in a process() function with your own impl. Guozhang On Thu, Nov 9, 2017 at 12:45 PM, Thaler, Michael < michael.tha...@forcepoint.com> wrote: > 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 events together. But what happens to > events 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 -- -- Guozhang