Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventPosition

Package version

Represents the position of an event in an Event Hub partition, typically used in the creation of an EventHubConsumer to specify the position in the partition to begin receiving events from.

Make use of the below static helpers to create an instance of EventPosition

  • fromOffset()
  • fromSequenceNumber()
  • fromEnqueuedTime()
  • earliest()
  • latest()
class

Hierarchy

  • EventPosition

Index

Properties

Optional enqueuedTime

enqueuedTime: Date | number
property

The enqueued time of the event identified by this position. Expected to be undefined if the position is just created from a sequence number or an offset.

isInclusive

isInclusive: boolean = false
property

Indicates if the specified offset is inclusive of the event which it identifies. This information is only relevent if the event position was identified by an offset or sequence number. Default value: false.

Optional offset

offset: number | "@latest"
property

The offset of the event identified by this position. Expected to be undefined if the position is just created from a sequence number or an enqueued time.

The offset is the relative position for an event in the context of the partition. The offset should not be considered a stable value. The same offset may refer to a different event as events reach the age limit for retention and are no longer visible within the partition.

Optional sequenceNumber

sequenceNumber: undefined | number
property

The sequence number of the event identified by this poistion. Expected to be undefined if the position is just created from an offset or enqueued time.

Methods

Static earliest

  • Gets an instance of EventPosition corresponding to the location of the 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 EventPosition

    EventPosition

Static fromEnqueuedTime

  • Gets an instance of EventPosition corresponding to a specific date and time within the partition to begin seeking an event; the event enqueued after the requested enqueuedTime will become the current position.

    Parameters

    • enqueuedTime: Date | number

      The date and time, in UTC, from which the next available event should be chosen.

    Returns EventPosition

    EventPosition

Static fromOffset

  • fromOffset(offset: number, isInclusive?: undefined | false | true): EventPosition
  • Gets an instance of EventPosition corresponding to the event in the partition at the provided offset.

    Parameters

    • offset: number

      The offset of an event with respect to its relative position in the partition.

    • Optional isInclusive: undefined | false | true

      If true, the specified event is included; otherwise the next event is returned. Default: false.

    Returns EventPosition

    EventPosition

Static fromSequenceNumber

  • fromSequenceNumber(sequenceNumber: number, isInclusive?: undefined | false | true): EventPosition
  • Gets an instance of EventPosition corresponding to the event in the partition having a specified sequence number associated with it.

    Parameters

    • sequenceNumber: number

      The sequence number assigned to an event when it was enqueued in the partition.

    • Optional isInclusive: undefined | false | true

      If true, event with the sequenceNumber is included; otherwise the next event in sequence will be received. Default false.

    Returns EventPosition

    EventPosition

Static latest

  • Gets an instance of EventPosition corresponding 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 partion after an EventHubConsumer is created with this position.

    Returns EventPosition

    EventPosition

Generated using TypeDoc