Class StreamTrigger


  • public final class StreamTrigger
    extends Object
    Contains timestamps required for triggering a stream.
    • Method Detail

      • of

        public static StreamTrigger of​(Instant queryStart,
                                       Instant queryEnd,
                                       Instant plannedStreamStart)
        Constructor.
        Parameters:
        queryStart - the minimum creation time of the entities to be queried
        queryEnd - the maximum creation time of the entities to be queried
        plannedStreamStart - the planned start of the stream: will normally be some time after queryStart, otherwise data might get lost due to clock drift etc.
        Returns:
        the new trigger.
      • getPlannedStreamStart

        public Instant getPlannedStreamStart()
        Returns the planned start of the stream.
        Returns:
        the planned start of the stream.
      • getQueryEnd

        public Instant getQueryEnd()
        Returns the minimum creation time of the entities to be queried.
        Returns:
        the minimum creation time of the entities to be queried.
      • getQueryStart

        public Instant getQueryStart()
        Returns the maximum creation time of the entities to be queried.
        Returns:
        the maximum creation time of the entities to be queried.
      • rescheduleAt

        public StreamTrigger rescheduleAt​(Instant newPlannedStreamStart)
        Reschedules this trigger at newPlannedStreamStart.
        Parameters:
        newPlannedStreamStart - the new planned stream start
        Returns:
        a new instance of trigger with newPlannedStreamStart.
      • calculateStreamTrigger

        public static StreamTrigger calculateStreamTrigger​(Instant now,
                                                           Instant queryStart,
                                                           Duration startOffset,
                                                           Duration streamInterval)
        Calculates a StreamTrigger based on the given parameters.
        Parameters:
        now - the current time
        queryStart - the minimum creation time of the entities to be queried.
        startOffset - the start-offset: the planned stream start (getPlannedStreamStart() will be at least this offset after queryStart. The actual start-offset may be bigger if queryStart is in the past.
        streamInterval - the interval of the stream: the query end getQueryEnd() is calculated by adding this interval to the query start getQueryStart().
        Returns:
        the trigger
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object