azure-messaging-eventhubs: Azure::Messaging::EventHubs::ConsumerClient Class Reference
David Richardson
Published Feb 17, 2026
The ConsumerClient class is a high level class used to consume events from an Event Hub. More...
#include <consumer_client.hpp>
| ConsumerClient (ConsumerClient const &other)=delete | |
| ConsumerClient (ConsumerClient &&other)=delete | |
| ConsumerClient & | operator= (ConsumerClient const &other)=delete |
| ConsumerClient & | operator= (ConsumerClient &&other)=delete |
| std::string const & | GetEventHubName () const |
| Getter for event hub name. | |
| std::string const & | GetConsumerGroup () const |
| Getter for consumer group name. | |
| Models::ConsumerClientDetails | GetDetails () const |
| Getter for client details. | |
| Azure::Core::Http::Policies::RetryOptions const & | GetRetryOptions () const |
| Getter for retry options. | |
| ConsumerClient (std::string const &connectionString, std::string const &eventHub={}, std::string const &consumerGroup=DefaultConsumerGroup, ConsumerClientOptions const &options={}) | |
| creates a ConsumerClient from a connection string. | |
| ConsumerClient (std::string const &fullyQualifiedNamespace, std::string const &eventHub, std::shared_ptr< Azure::Core::Credentials::TokenCredential > credential, std::string const &consumerGroup=DefaultConsumerGroup, ConsumerClientOptions const &options={}) | |
| creates a ConsumerClient from a token credential. | |
| PartitionClient | CreatePartitionClient (std::string const &partitionId, PartitionClientOptions const &options={}, Azure::Core::Context const &context={}) |
| Create new Partition client. | |
| void | Close (Azure::Core::Context const &context) |
| Closes the consumer client canceling any operations outstanding on any of the existing partition clients. | |
| Models::EventHubProperties | GetEventHubProperties (Core::Context const &context={}) |
| GetEventHubProperties gets properties of an eventHub. This includes data like name, and partitions. | |
| Models::EventHubPartitionProperties | GetPartitionProperties (std::string const &partitionID, Core::Context const &context={}) |
| GetPartitionProperties gets properties for a specific partition. This includes data like the last enqueued sequence number, the first sequence number and when an event was last enqueued to the partition. | |
The ConsumerClient class uses a Azure::Messaging::EventHubs::PartitionClient to receive events from a specific partition of an Event Hub. The Azure::Messaging::EventHubs::PartitionClient is created by the ConsumerClient and is available via the NewPartitionClient method. The ConsumerClient is also responsible for managing the connection to the Event Hub and will reconnect as necessary.
◆ ConsumerClient() [1/4]
| delete |
◆ ConsumerClient() [2/4]
| delete |
Move a consumer client
◆ ConsumerClient() [3/4]
| Azure::Messaging::EventHubs::ConsumerClient::ConsumerClient | ( | std::string const & | connectionString, |
| std::string const & | eventHub = {}, | ||
| std::string const & | consumerGroup = DefaultConsumerGroup, | ||
| ConsumerClientOptions const & | options = {} | ||
| ) |
- Parameters
-
connectionString connection string to resource eventHub event hub name consumerGroup consumer group name options client options
◆ ConsumerClient() [4/4]
| Azure::Messaging::EventHubs::ConsumerClient::ConsumerClient | ( | std::string const & | fullyQualifiedNamespace, |
| std::string const & | eventHub, | ||
| std::shared_ptr< Azure::Core::Credentials::TokenCredential > | credential, | ||
| std::string const & | consumerGroup = DefaultConsumerGroup, | ||
| ConsumerClientOptions const & | options = {} | ||
| ) |
- Parameters
-
fullyQualifiedNamespace fully qualified namespace name (e.g. myeventhub.servicebus.windows.net) eventHub event hub name consumerGroup consumer group name credential Token credential options client options
| void Azure::Messaging::EventHubs::ConsumerClient::Close | ( | Azure::Core::Context const & | context | ) |
- Parameters
-
context The context for the operation can be used for request cancellation.
◆ CreatePartitionClient()
| PartitionClient Azure::Messaging::EventHubs::ConsumerClient::CreatePartitionClient | ( | std::string const & | partitionId, |
| PartitionClientOptions const & | options = {}, | ||
| Azure::Core::Context const & | context = {} | ||
| ) |
- Parameters
-
partitionId targeted partition options client options context The context for the operation can be used for request cancellation.
◆ GetConsumerGroup()
| inline |
- Returns
- Consumer group name for client
◆ GetDetails()
- Returns
- Client details for client
◆ GetEventHubName()
| inline |
- Returns
- Event hub name for client
◆ GetEventHubProperties()
| Models::EventHubProperties Azure::Messaging::EventHubs::ConsumerClient::GetEventHubProperties | ( | Core::Context const & | context = {} | ) |
◆ GetPartitionProperties()
| Models::EventHubPartitionProperties Azure::Messaging::EventHubs::ConsumerClient::GetPartitionProperties | ( | std::string const & | partitionID, |
| Core::Context const & | context = {} | ||
| ) |
- Parameters
-
partitionID partition ID to detail. context The context for the operation can be used for request cancellation.
◆ GetRetryOptions()
| inline |
- Returns
- Retry options for client
◆ operator=() [1/2]
Move a consumer client
◆ operator=() [2/2]
The documentation for this class was generated from the following files: