Show / Hide Table of Contents

Struct EventPosition

The position of events in an Event Hub partition, typically used in the creation of an EventHubConsumerClient.

Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Messaging.EventHubs.dll
Syntax
public struct EventPosition : IEquatable<Azure.Messaging.EventHubs.Consumer.EventPosition>

Properties

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.

Declaration
public static Azure.Messaging.EventHubs.Consumer.EventPosition Earliest { get; }
Property Value
EventPosition

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 after an event consumer begins reading with this position.

Declaration
public static Azure.Messaging.EventHubs.Consumer.EventPosition Latest { get; }
Property Value
EventPosition

Methods

Equals(EventPosition)

Determines whether the specified EventPosition is equal to this instance.

Declaration
public bool Equals (Azure.Messaging.EventHubs.Consumer.EventPosition other);
Parameters
EventPosition other

The EventPosition to compare with this instance.

Returns
System.Boolean

true if the specified EventPosition is equal to this instance; otherwise, false.

Equals(Object)

Determines whether the specified System.Object is equal to this instance.

Declaration
[System.ComponentModel.EditorBrowsable]
public override bool Equals (object obj);
Parameters
System.Object obj

The System.Object to compare with this instance.

Returns
System.Boolean

true if the specified System.Object is equal to this instance; otherwise, false.

FromEnqueuedTime(DateTimeOffset)

Corresponds to a specific date and time within the partition to begin seeking an event; the event enqueued on or after the specified enqueuedTime will be read.

Declaration
public static Azure.Messaging.EventHubs.Consumer.EventPosition FromEnqueuedTime (DateTimeOffset enqueuedTime);
Parameters
System.DateTimeOffset enqueuedTime

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

Returns
EventPosition

The specified position of an event in the partition.

FromOffset(Int64, Boolean)

Obsolete.

Corresponds to a specific offset in the partition event stream. By default, if an event is located at that offset, it will be read. Setting isInclusive to false will skip the event at that offset and begin reading at the next available event.

Declaration
[System.ComponentModel.EditorBrowsable]
[System.Obsolete("The Event Hubs service does not guarantee a numeric offset for all resource configurations.  Reading events using a numeric offset may not work in all cases going forward. Please use a string-based offset instead.", false)]
public static Azure.Messaging.EventHubs.Consumer.EventPosition FromOffset (long offset, bool isInclusive = true);
Parameters
System.Int64 offset

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

System.Boolean isInclusive

When true, the event with the offset is included; otherwise the next event in sequence will be read.

Returns
EventPosition

The specified position of an event in the partition.

Remarks

This method is obsolete and should no longer be used. Please use FromOffset(String, Boolean) instead.

FromOffset(String, Boolean)

Corresponds to a specific offset in the partition event stream. By default, if an event is located at that offset, it will be read. Setting isInclusive to false will skip the event at that offset and begin reading at the next available event.

Declaration
public static Azure.Messaging.EventHubs.Consumer.EventPosition FromOffset (string offsetString, bool isInclusive = true);
Parameters
System.String offsetString

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

System.Boolean isInclusive

When true, the event with the offsetString is included; otherwise the next event in sequence will be read.

Returns
EventPosition

The specified position of an event in the partition.

FromSequenceNumber(Int64, Boolean)

Corresponds to an event with the specified sequence number in the partition. By default, the event with this sequenceNumber will be read. Setting isInclusive to false will skip the event with that sequence number and begin reading at the next available event.

Declaration
public static Azure.Messaging.EventHubs.Consumer.EventPosition FromSequenceNumber (long sequenceNumber, bool isInclusive = true);
Parameters
System.Int64 sequenceNumber

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

System.Boolean isInclusive

When true, the event with the sequenceNumber is included; otherwise the next event in sequence will be read.

Returns
EventPosition

The specified position of an event in the partition.

GetHashCode()

Returns a hash code for this instance.

Declaration
[System.ComponentModel.EditorBrowsable]
public override int GetHashCode ();
Returns
System.Int32

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Converts the instance to string representation.

Declaration
public override string ToString ();
Returns
System.String

A System.String that represents the position in the event stream.

Operators

Equality(EventPosition, EventPosition)

Determines whether the specified EventPosition instances are equal to each other.

Declaration
public static bool operator == (Azure.Messaging.EventHubs.Consumer.EventPosition left, Azure.Messaging.EventHubs.Consumer.EventPosition right);
Parameters
EventPosition left

The first EventPosition to consider.

EventPosition right

The second EventPosition to consider.

Returns
System.Boolean

true if the two specified EventPosition instances are equal; otherwise, false.

Inequality(EventPosition, EventPosition)

Determines whether the specified EventPosition instances are not equal to each other.

Declaration
public static bool operator != (Azure.Messaging.EventHubs.Consumer.EventPosition left, Azure.Messaging.EventHubs.Consumer.EventPosition right);
Parameters
EventPosition left

The first EventPosition to consider.

EventPosition right

The second EventPosition to consider.

Returns
System.Boolean

true if the two specified EventPosition instances are not equal; otherwise, false.

Back to top Azure SDK for .NET