public class JoinWindows extends Windows<org.apache.kafka.streams.kstream.internals.TimeWindow>
A JoinWindows
instance defines a join over two stream on the same key and a maximum time difference.
In SQL-style you would express this join as
SELECT * FROM stream1, stream2 WHERE stream1.key = stream2.key AND stream2.ts - before <= stream1.ts <= stream2.ts + afterThere are three different window configuration supported:
Modifier and Type | Field and Description |
---|---|
long |
after
Maximum time difference for tuples that are after the join tuple.
|
long |
before
Maximum time difference for tuples that are before the join tuple.
|
Modifier and Type | Method and Description |
---|---|
JoinWindows |
after(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
the join window interval, and if the timestamp of a record from the secondary stream
is later than or equal to the timestamp of a record from the first stream.
|
JoinWindows |
before(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
the join window interval, and if the timestamp of a record from the secondary stream is
earlier than or equal to the timestamp of a record from the first stream.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
static JoinWindows |
of(java.lang.String name) |
java.util.Map<java.lang.Long,org.apache.kafka.streams.kstream.internals.TimeWindow> |
windowsFor(long timestamp)
Not supported by
JoinWindows . |
JoinWindows |
within(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
timeDifference . |
maintainMs, name, segments, until
public final long before
public final long after
public static JoinWindows of(java.lang.String name)
public JoinWindows within(long timeDifference)
timeDifference
.timeDifference
- join window intervalpublic JoinWindows before(long timeDifference)
timeDifference
- join window intervalpublic JoinWindows after(long timeDifference)
timeDifference
- join window intervalpublic java.util.Map<java.lang.Long,org.apache.kafka.streams.kstream.internals.TimeWindow> windowsFor(long timestamp)
JoinWindows
. Throws UnsupportedOperationException
.windowsFor
in class Windows<org.apache.kafka.streams.kstream.internals.TimeWindow>
timestamp
- the timestamp window should get created forwindowStartTimestamp -> Window
entriespublic final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object