EventHubConsumerClient Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A client responsible for reading EventData from a specific Event Hub as a member of a specific consumer group.
A consumer may be exclusive, which asserts ownership over associated partitions for the consumer group to ensure that only one consumer from that group is reading the from the partition. These exclusive consumers are sometimes referred to as "Epoch Consumers."
A consumer may also be non-exclusive, allowing multiple consumers from the same consumer group to be actively reading events from a given partition. These non-exclusive consumers are sometimes referred to as "Non-Epoch Consumers."
public class EventHubConsumerClient : IAsyncDisposable
type EventHubConsumerClient = class
interface IAsyncDisposable
Public Class EventHubConsumerClient
Implements IAsyncDisposable
- Inheritance
-
EventHubConsumerClient
- Implements
Remarks
The EventHubConsumerClient is safe to cache and use for the lifetime of an application, which is the best practice when the application reads events regularly or semi-regularly. The consumer is responsible for ensuring efficient network, CPU, and memory use. Calling either CloseAsync(CancellationToken) or DisposeAsync() as the application is shutting down will ensure that network resources and other unmanaged objects are properly cleaned up.
Constructors
Fields
DefaultConsumerGroupName |
The name of the default consumer group in the Event Hubs service. |
Properties
ConsumerGroup |
The name of the consumer group that this consumer is associated with. Events will be read only in the context of this group. |
EventHubName |
The name of the Event Hub that the consumer is connected to, specific to the Event Hubs namespace that contains it. |
FullyQualifiedNamespace |
The fully qualified Event Hubs namespace that the consumer is associated with. This is likely
to be similar to |
Identifier |
A unique name used to identify this consumer. |
IsClosed |
Indicates whether or not this EventHubConsumerClient has been closed. |
Methods
CloseAsync(CancellationToken) |
Closes the consumer. |
DisposeAsync() |
Performs the task needed to clean up resources used by the EventHubConsumerClient, including ensuring that the client itself has been closed. |
GetEventHubPropertiesAsync(CancellationToken) |
Retrieves information about the Event Hub that the connection is associated with, including the number of partitions present and their identifiers. |
GetPartitionIdsAsync(CancellationToken) |
Retrieves the set of identifiers for the partitions of an Event Hub. |
GetPartitionPropertiesAsync(String, CancellationToken) |
Retrieves information about a specific partition for an Event Hub, including elements that describe the available events in the partition event stream. |
ReadEventsAsync(Boolean, ReadEventOptions, CancellationToken) |
Reads events from all partitions of the event hub as an asynchronous enumerable, allowing events to be iterated as they become available on the partition, waiting as necessary should there be no events available. This enumerator may block for an indeterminate amount of time for an |
ReadEventsAsync(CancellationToken) |
Reads events from all partitions of the event hub as an asynchronous enumerable, allowing events to be iterated as they become available on the partition, waiting as necessary should there be no events available. This enumerator may block for an indeterminate amount of time for an |
ReadEventsAsync(ReadEventOptions, CancellationToken) |
Reads events from all partitions of the event hub as an asynchronous enumerable, allowing events to be iterated as they become available on the partition, waiting as necessary should there be no events available. This enumerator may block for an indeterminate amount of time for an |
ReadEventsFromPartitionAsync(String, EventPosition, CancellationToken) |
Reads events from the requested partition as an asynchronous enumerable, allowing events to be iterated as they become available on the partition, waiting as necessary should there be no events available. This enumerator may block for an indeterminate amount of time for an |
ReadEventsFromPartitionAsync(String, EventPosition, ReadEventOptions, CancellationToken) |
Reads events from the requested partition as an asynchronous enumerable, allowing events to be iterated as they become available on the partition, waiting as necessary should there be no events available. This enumerator may block for an indeterminate amount of time for an |