Share via


EventHubClient.CreateEpochReceiver Method

Definition

Create a Epoch based EventHub receiver with given EventPosition. The receiver is created for a specific EventHub Partition from the specific consumer group.

It is important to pay attention to the following when creating epoch based receiver:

- Ownership enforcement: Once you created an epoch based receiver, you cannot create a non-epoch receiver to the same consumerGroup-Partition combo until all receivers to the combo are closed.

- Ownership stealing: If a receiver with higher epoch value is created for a consumerGroup-Partition combo, any older epoch receiver to that combo will be force closed.

- Any receiver closed due to lost of ownership to a consumerGroup-Partition combo will get ReceiverDisconnectedException for all operations from that receiver.
public Microsoft.Azure.EventHubs.PartitionReceiver CreateEpochReceiver (string consumerGroupName, string partitionId, Microsoft.Azure.EventHubs.EventPosition eventPosition, long epoch, Microsoft.Azure.EventHubs.ReceiverOptions receiverOptions = default);
member this.CreateEpochReceiver : string * string * Microsoft.Azure.EventHubs.EventPosition * int64 * Microsoft.Azure.EventHubs.ReceiverOptions -> Microsoft.Azure.EventHubs.PartitionReceiver
Public Function CreateEpochReceiver (consumerGroupName As String, partitionId As String, eventPosition As EventPosition, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As PartitionReceiver

Parameters

consumerGroupName
String

the consumer group name that this receiver should be grouped under.

partitionId
String

the partition Id that the receiver belongs to. All data received will be from this partition only.

eventPosition
EventPosition

The starting EventPosition at which to start receiving messages.

epoch
Int64

a unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

The created PartitionReceiver

Applies to

See also