Class EventPosition
java.lang.Object
com.azure.messaging.eventhubs.models.EventPosition
Defines a position of an
EventData in the Event Hub partition stream. The position can be an offset,
sequence number, or enqueued time in UTC.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic EventPositionearliest()Corresponds to the location of the first event present in the partition.booleanstatic EventPositionfromEnqueuedTime(Instant enqueuedDateTime) Creates a position at the givenInstant.static EventPositionfromOffset(long offset) Deprecated.This method is obsolete and should no longer be used.static EventPositionfromOffsetString(String offset) Creates a position to an event in the partition at the provided offset.static EventPositionfromSequenceNumber(long sequenceNumber) Creates a position to an event in the partition at the provided sequence number.static EventPositionfromSequenceNumber(long sequenceNumber, boolean isInclusive) Creates a position at the given sequence number.Gets the instant, in UTC, from which the next available event should be chosen.Gets the relative position for event in the context of the stream.Gets the sequence number of the event.inthashCode()booleanGets the boolean value of if the event is included.static EventPositionlatest()Corresponds to the end of the partition, where no more events are currently enqueued.toString()
-
Method Details
-
earliest
Corresponds to the location of the first event present in the partition. Use this position to begin receiving from the first event that was enqueued in the partition which has not expired due to the retention policy.- Returns:
- An
EventPositionset to the start of an Event Hub stream.
-
latest
Corresponds to the end of the partition, where no more events are currently enqueued. Use this position to begin receiving from the next event to be enqueued in the partition whenreceiveFromPartition()invoked.- Returns:
- An
EventPositionset to the end of an Event Hubs stream and listens for new events.
-
fromEnqueuedTime
Creates a position at the givenInstant. Corresponds to a specific instance within a partition to begin looking for an event. The event enqueued after the requestedenqueuedDateTimebecomes the current position.- Parameters:
enqueuedDateTime- The instant, in UTC, from which the next available event should be chosen.- Returns:
- An
EventPositionobject.
-
fromOffset
Deprecated.This method is obsolete and should no longer be used. Please usefromOffsetString(String).Creates a position to an event in the partition at the provided offset. The event at that offset will not be included. Instead, the next event is returned.The offset is the relative position for event in the context of the stream. The offset should not be considered a stable value, as the same offset may refer to a different event as events reach the age limit for retention and are no longer visible within the stream.
- Parameters:
offset- The offset of the event within that partition.- Returns:
- An
EventPositionobject.
-
fromOffsetString
Creates a position to an event in the partition at the provided offset. The event at that offset will not be included. Instead, the next event is returned.The offset is the relative position for event in the context of the stream. The offset should not be considered a stable value, as the same offset may refer to a different event as events reach the age limit for retention and are no longer visible within the stream.
- Parameters:
offset- The offset of the event within that partition.- Returns:
- An
EventPositionobject.
-
fromSequenceNumber
Creates a position to an event in the partition at the provided sequence number. The event with the sequence number will not be included. Instead, the next event is returned.- Parameters:
sequenceNumber- is the sequence number of the event.- Returns:
- An
EventPositionobject.
-
fromSequenceNumber
Creates a position at the given sequence number. IfisInclusiveis true, the event with the same sequence number is returned. Otherwise, the next event in the sequence is received.- Parameters:
sequenceNumber- is the sequence number of the event.isInclusive- If true, the event with thesequenceNumberis included; otherwise, the next event will be received.- Returns:
- An
EventPositionobject.
-
isInclusive
public boolean isInclusive()Gets the boolean value of if the event is included. If true, the event with thesequenceNumberis included; otherwise, the next event will be received.- Returns:
- The boolean if the event will be received.
-
getOffset
Gets the relative position for event in the context of the stream. The offset should not be considered a stable value, as the same offset may refer to a different event as events reach the age limit for retention and are no longer visible within the stream.- Returns:
- The offset of the event within that partition.
-
getSequenceNumber
Gets the sequence number of the event.- Returns:
- The sequence number of the event.
-
getEnqueuedDateTime
Gets the instant, in UTC, from which the next available event should be chosen.- Returns:
- The instant, in UTC, from which the next available event should be chosen.
-
toString
-
equals
-
hashCode
public int hashCode()
-