Class StreamTrigger
- java.lang.Object
-
- org.eclipse.ditto.services.utils.akka.streaming.StreamTrigger
-
public final class StreamTrigger extends Object
Contains timestamps required for triggering a stream.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StreamTriggercalculateStreamTrigger(Instant now, Instant queryStart, Duration startOffset, Duration streamInterval)Calculates aStreamTriggerbased on the given parameters.booleanequals(Object o)InstantgetPlannedStreamStart()Returns the planned start of the stream.InstantgetQueryEnd()Returns the minimum creation time of the entities to be queried.InstantgetQueryStart()Returns the maximum creation time of the entities to be queried.inthashCode()static StreamTriggerof(Instant queryStart, Instant queryEnd, Instant plannedStreamStart)Constructor.StreamTriggerrescheduleAt(Instant newPlannedStreamStart)Reschedules this trigger atnewPlannedStreamStart.StringtoString()
-
-
-
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 queriedqueryEnd- the maximum creation time of the entities to be queriedplannedStreamStart- the planned start of the stream: will normally be some time afterqueryStart, 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 atnewPlannedStreamStart.- 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 aStreamTriggerbased on the given parameters.- Parameters:
now- the current timequeryStart- 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 afterqueryStart. The actual start-offset may be bigger ifqueryStartis in the past.streamInterval- the interval of the stream: the query endgetQueryEnd()is calculated by adding this interval to the query startgetQueryStart().- Returns:
- the trigger
-
-