I
InsightNexus

azure-messaging-eventhubs: Azure::Messaging::EventHubs::ConsumerClient Class Reference

Author

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
 
ConsumerClientoperator= (ConsumerClient const &other)=delete
 
ConsumerClientoperator= (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]

Azure::Messaging::EventHubs::ConsumerClient::ConsumerClient ( ConsumerClient const &  other)
delete

◆ ConsumerClient() [2/4]

Azure::Messaging::EventHubs::ConsumerClient::ConsumerClient ( ConsumerClient &&  other)
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
connectionStringconnection string to resource
eventHubevent hub name
consumerGroupconsumer group name
optionsclient 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
fullyQualifiedNamespacefully qualified namespace name (e.g. myeventhub.servicebus.windows.net)
eventHubevent hub name
consumerGroupconsumer group name
credentialToken credential
optionsclient options
void Azure::Messaging::EventHubs::ConsumerClient::Close ( Azure::Core::Context const &  context)
Parameters
contextThe 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
partitionIdtargeted partition
optionsclient options
contextThe context for the operation can be used for request cancellation.

◆ GetConsumerGroup()

std::string const & Azure::Messaging::EventHubs::ConsumerClient::GetConsumerGroup ( ) const
inline
Returns
Consumer group name for client

◆ GetDetails()

Returns
Client details for client

◆ GetEventHubName()

std::string const & Azure::Messaging::EventHubs::ConsumerClient::GetEventHubName ( ) const
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
partitionIDpartition ID to detail.
contextThe context for the operation can be used for request cancellation.

◆ GetRetryOptions()

Azure::Core::Http::Policies::RetryOptions const & Azure::Messaging::EventHubs::ConsumerClient::GetRetryOptions ( ) const
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: