Class JoinWindows

    • Field Summary

      Fields 
      Modifier and Type Field Description
      long afterMs
      Maximum time difference for tuples that are after the join tuple.
      long beforeMs
      Maximum time difference for tuples that are before the join tuple.
      • Fields inherited from class org.apache.kafka.streams.kstream.Windows

        segments
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JoinWindows after​(long timeDifferenceMs)
      Changes the end window boundary to timeDifferenceMs but keep the start window boundary as is.
      JoinWindows before​(long timeDifferenceMs)
      Changes the start window boundary to timeDifferenceMs but keep the end window boundary as is.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      long maintainMs()
      Return the window maintain duration (retention time) in milliseconds.
      static JoinWindows of​(long timeDifferenceMs)
      Specifies that records of the same key are joinable if their timestamps are within timeDifferenceMs, i.e., the timestamp of a record from the secondary stream is max timeDifferenceMs earlier or later than the timestamp of the record from the primary stream.
      long size()
      Return the size of the specified windows in milliseconds.
      JoinWindows until​(long durationMs)
      Set the window maintain duration (retention time) in milliseconds.
      java.util.Map<java.lang.Long,​Window> windowsFor​(long timestamp)
      Not supported by JoinWindows.
      • Methods inherited from class org.apache.kafka.streams.kstream.Windows

        segments
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • beforeMs

        public final long beforeMs
        Maximum time difference for tuples that are before the join tuple.
      • afterMs

        public final long afterMs
        Maximum time difference for tuples that are after the join tuple.
    • Method Detail

      • of

        public static JoinWindows of​(long timeDifferenceMs)
                              throws java.lang.IllegalArgumentException
        Specifies that records of the same key are joinable if their timestamps are within timeDifferenceMs, i.e., the timestamp of a record from the secondary stream is max timeDifferenceMs earlier or later than the timestamp of the record from the primary stream.
        Parameters:
        timeDifferenceMs - join window interval in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if timeDifferenceMs is negative
      • before

        public JoinWindows before​(long timeDifferenceMs)
                           throws java.lang.IllegalArgumentException
        Changes the start window boundary to timeDifferenceMs but keep the end window boundary as is. Thus, records of the same key are joinable if the timestamp of a record from the secondary stream is at most timeDifferenceMs earlier than the timestamp of the record from the primary stream. timeDifferenceMs can be negative but it's absolute value must not be larger than current window "after" value (which would result in a negative window size).
        Parameters:
        timeDifferenceMs - relative window start time in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if the resulting window size is negative
      • after

        public JoinWindows after​(long timeDifferenceMs)
                          throws java.lang.IllegalArgumentException
        Changes the end window boundary to timeDifferenceMs but keep the start window boundary as is. Thus, records of the same key are joinable if the timestamp of a record from the secondary stream is at most timeDifferenceMs later than the timestamp of the record from the primary stream. timeDifferenceMs can be negative but it's absolute value must not be larger than current window "before" value (which would result in a negative window size).
        Parameters:
        timeDifferenceMs - relative window end time in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if the resulting window size is negative
      • windowsFor

        public java.util.Map<java.lang.Long,​Window> windowsFor​(long timestamp)
        Not supported by JoinWindows. Throws UnsupportedOperationException.
        Specified by:
        windowsFor in class Windows<Window>
        Parameters:
        timestamp - the timestamp window should get created for
        Returns:
        a map of windowStartTimestamp -> Window entries
        Throws:
        java.lang.UnsupportedOperationException - at every invocation
      • size

        public long size()
        Description copied from class: Windows
        Return the size of the specified windows in milliseconds.
        Specified by:
        size in class Windows<Window>
        Returns:
        the size of the specified windows
      • until

        public JoinWindows until​(long durationMs)
                          throws java.lang.IllegalArgumentException
        Description copied from class: Windows
        Set the window maintain duration (retention time) in milliseconds. This retention time is a guaranteed lower bound for how long a window will be maintained.
        Overrides:
        until in class Windows<Window>
        Parameters:
        durationMs - the window retention time in milliseconds
        Returns:
        itself
        Throws:
        java.lang.IllegalArgumentException - if durationMs is smaller than the window size
      • maintainMs

        public long maintainMs()
        Return the window maintain duration (retention time) in milliseconds.

        For TimeWindows the maintain duration is at least as small as the window size.

        Overrides:
        maintainMs in class Windows<Window>
        Returns:
        the window maintain duration
      • equals

        public final boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object