Share via


EventHubConsumerGroup.CreateReceiver Method

Definition

Overloads

CreateReceiver(String, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, DateTime, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, starting at the specified date and time. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, and the specified epoch value. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, String, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, EventPosition, Nullable<Int64>, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting position. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, DateTime, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, starting at the specified date and time. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, String, Boolean, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, String, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset.

CreateReceiver(String, String, Boolean, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

CreateReceiver(String, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver object that is tied to the given Event Hubs partition.

Exceptions

Thrown if the service encounters a transient error.

Thrown if the client has a problem connecting to the service.

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Thrown if the number of receivers currently connected to the partition specified by partitionId has exceeded the maximum allowed quota set by the service.

Thrown if there is currently a receiver connected to the partition as specified by partitionId.

Remarks

If the EventHubConsumerGroup has checkpoint enabled, this overload will always throw InvalidOperationException because checkpoint enabled ConsumerGroup requires epoch to work (please use the overload that supply epoch as input argument). If checkpoint is disabled, then receiver will get message from the start of the event stream, as determined by the message retention policy of the Event Hub.

Applies to

CreateReceiver(String, DateTime, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, starting at the specified date and time. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, DateTime startingDateTimeUtc, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * DateTime * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingDateTimeUtc As DateTime, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingDateTimeUtc
DateTime

The starting UTC time for receiving messages.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver.

Exceptions

Thrown if the service encounters a transient error.

Thrown if the client has a problem connecting to the service.

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Thrown if the number of receivers currently connected to the partition specified by partitionId has exceeded the maximum allowed quota set by the service.

Thrown if there is currently a receiver connected to the partition as specified by partitionId, with an startingDateTimeUtc specified.

Remarks

Service only uses this startingDateTimeUtc as an approximation when determining next event to deliver.

Keep in mind that there can be clock skew between client time and service time, so user application should be designed to handle duplication in event delivery.

Applies to

CreateReceiver(String, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, and the specified epoch value. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

epoch
Int64

The epoch value. The service uses this value to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver.

Exceptions

Thrown if the service encounters a transient error.

Thrown if the client has a problem connecting to the service.

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Remarks

If the EventHubConsumerGroup has checkpoint enabled, then the receiver will get next message from the checkpoint offset. If checkpoint is disabled, then receiver will get message from the start of the event stream, as determined by the message retention policy of the event hub.

Applies to

CreateReceiver(String, String, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, string startingOffset, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * string * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingOffset As String, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingOffset
String

The starting offset at which to start receiving messages.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver.

Exceptions

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Thrown if the number of receivers currently connected to the partition specified by partitionId has exceeded the maximum allowed quota set by the service.

Thrown if there is currently a receiver connected to the partition as specified by partitionId, with an startingOffset specified.

Applies to

CreateReceiver(String, EventPosition, Nullable<Int64>, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting position. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, Microsoft.ServiceBus.Messaging.EventPosition position, long? epoch = default, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * Microsoft.ServiceBus.Messaging.EventPosition * Nullable<int64> * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, position As EventPosition, Optional epoch As Nullable(Of Long) = Nothing, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

position
EventPosition

The starting EventPosition at which to start receiving messages.

epoch
Nullable<Int64>

The epoch value. If set, the service uses this value to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns EventHubReceiver.

Applies to

CreateReceiver(String, DateTime, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, starting at the specified date and time. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, DateTime startingDateTimeUtc, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * DateTime * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingDateTimeUtc As DateTime, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingDateTimeUtc
DateTime

The starting UTC time for receiving messages.

epoch
Int64

The epoch value. The service uses this value to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver.

Exceptions

Thrown if the service encounters a transient error.

Thrown if the client has a problem connecting to the service.

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Remarks

Service only uses this startingDateTimeUtc as an approximation when determining next event to deliver.

Keep in mind that there can be clock skew between client time and service time, so user application should be designed to handle duplication in event delivery.

Applies to

CreateReceiver(String, String, Boolean, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, string startingOffset, bool offsetInclusive, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * string * bool * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingOffset As String, offsetInclusive As Boolean, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingOffset
String

The starting offset at which to start receiving messages.

offsetInclusive
Boolean

A Boolean value that indicates whether startingOffset is treated as an inclusive offset, meaning that the first Options for a event hub receiver. event returned is the event that contains the starting offset. Normally, the first event returned is the event after the starting offset.

receiverOptions
ReceiverOptions

Returns

Returns EventHubReceiver.

Applies to

CreateReceiver(String, String, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, string startingOffset, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * string * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingOffset As String, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingOffset
String

The starting offset at which to start receiving messages. To specify the start of the stream, see StartOfStream.

epoch
Int64

The epoch value. The service uses this value to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns the EventHubReceiver.

Exceptions

Thrown if the service encounters a transient error.

Thrown if the client has a problem connecting to the service.

Thrown if partitionId is not within the expected range, as determined by the PartitionCount property.

Applies to

CreateReceiver(String, String, Boolean, Int64, ReceiverOptions)

Creates a new Event Hubs receiver in the specified partition, at the specified starting offset. You can use the created receiver to receive events for one Event Hubs partition, specified by partitionId.

public Microsoft.ServiceBus.Messaging.EventHubReceiver CreateReceiver (string partitionId, string startingOffset, bool offsetInclusive, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiver : string * string * bool * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> Microsoft.ServiceBus.Messaging.EventHubReceiver
Public Function CreateReceiver (partitionId As String, startingOffset As String, offsetInclusive As Boolean, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As EventHubReceiver

Parameters

partitionId
String

The ID of the partition.

startingOffset
String

The starting offset at which to start receiving messages.

offsetInclusive
Boolean

A Boolean value that indicates whether startingOffset is treated as an inclusive offset, meaning that the first event returned is the event that contains the starting offset. Normally, the first event returned is the event after the starting offset.

epoch
Int64

The epoch value. The service uses this value to enforce partition/lease ownership.

receiverOptions
ReceiverOptions

Options for a event hub receiver.

Returns

Returns EventHubReceiver.

Applies to