Package com.microsoft.azure.eventhubs
Interface EventPosition
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
EventPositionImpl
public interface EventPosition extends Serializable
Defines a position of anEventData
in the event hub partition. The position can be an Offset, Sequence Number, or EnqueuedTime.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static EventPosition
fromEndOfStream()
Returns the position for the end of a stream.static EventPosition
fromEnqueuedTime(Instant dateTime)
Creates a position at the givenInstant
.static EventPosition
fromOffset(String offset)
Creates a position at the given offset.static EventPosition
fromOffset(String offset, boolean inclusiveFlag)
Creates a position at the given offset.static EventPosition
fromSequenceNumber(Long sequenceNumber)
Creates a position at the given sequence number.static EventPosition
fromSequenceNumber(Long sequenceNumber, boolean inclusiveFlag)
Creates a position at the given sequence number.static EventPosition
fromStartOfStream()
Returns the position for the start of a stream.Instant
getEnqueuedTime()
Gets the enqueued time.boolean
getInclusiveFlag()
Gets the inclusive value.String
getOffset()
Gets the offset.Long
getSequenceNumber()
Gets the sequence number.
-
-
-
Method Detail
-
fromOffset
static EventPosition fromOffset(String offset)
Creates a position at the given offset. The specified event will not be included. Instead, the next event is returned.- Parameters:
offset
- is the byte offset of the event.- Returns:
- An
EventPosition
object.
-
fromOffset
static EventPosition fromOffset(String offset, boolean inclusiveFlag)
Creates a position at the given offset.- Parameters:
offset
- is the byte offset of the event.inclusiveFlag
- will include the specified event when set to true; otherwise, the next event is returned.- Returns:
- An
EventPosition
object.
-
fromSequenceNumber
static EventPosition fromSequenceNumber(Long sequenceNumber)
Creates a position at the given sequence number. The specified event will not be included. Instead, the next event is returned.- Parameters:
sequenceNumber
- is the sequence number of the event.- Returns:
- An
EventPosition
object.
-
fromSequenceNumber
static EventPosition fromSequenceNumber(Long sequenceNumber, boolean inclusiveFlag)
Creates a position at the given sequence number. The specified event will not be included. Instead, the next event is returned.- Parameters:
sequenceNumber
- is the sequence number of the event.inclusiveFlag
- will include the specified event when set to true; otherwise, the next event is returned.- Returns:
- An
EventPosition
object.
-
fromEnqueuedTime
static EventPosition fromEnqueuedTime(Instant dateTime)
Creates a position at the givenInstant
.- Parameters:
dateTime
- is the enqueued time of the event.- Returns:
- An
EventPosition
object.
-
fromStartOfStream
static EventPosition fromStartOfStream()
Returns the position for the start of a stream. Provide this position in receiver creation to start receiving from the first available event in the partition.- Returns:
- An
EventPosition
set to the start of an Event Hubs stream.
-
fromEndOfStream
static EventPosition fromEndOfStream()
Returns the position for the end of a stream. Provide this position in receiver creation to start receiving from the next available event in the partition after the receiver is created.- Returns:
- An
EventPosition
set to the end of an Event Hubs stream.
-
getSequenceNumber
Long getSequenceNumber()
Gets the sequence number.- Returns:
- the sequence number.
-
getEnqueuedTime
Instant getEnqueuedTime()
Gets the enqueued time.- Returns:
- the enqueued time.
-
getOffset
String getOffset()
Gets the offset.- Returns:
- the offset.
-
getInclusiveFlag
boolean getInclusiveFlag()
Gets the inclusive value.- Returns:
- the inclusive value.
-
-