azure-messaging-eventhubs
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Azure::Messaging::EventHubs::ConsumerClient Class Referencefinal

The ConsumerClient class is a high level class used to consume events from an Event Hub. More...

#include <consumer_client.hpp>

Public Member Functions

 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ConsumerClient() [1/4]

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

Copy a new ConsumerClient from an existing one.

◆ 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
Remarks
connectionString can be one of two formats - with or without an EntityPath key. When the connection string does not have an entity path, as shown below, the eventHub parameter cannot be empty and should contain the name of your event hub. Endpoint=sb://<your-namespace>.servicebus.windows.net/;SharedAccessKeyName=<key-name>;SharedAccessKey=<key> When the connection string DOES have an entity path, as shown below, the eventHub parameter must match the entity path. Endpoint=sb://<your-namespace>.servicebus.windows.net/; SharedAccessKeyName=<key-name>;SharedAccessKey=<key>;EntityPath=<entitypath>;

◆ 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

Member Function Documentation

◆ Close()

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()

Models::ConsumerClientDetails Azure::Messaging::EventHubs::ConsumerClient::GetDetails ( ) const
inline
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]

ConsumerClient & Azure::Messaging::EventHubs::ConsumerClient::operator= ( ConsumerClient &&  other)
delete

Move a consumer client

◆ operator=() [2/2]

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

Assign a ConsumerClient to an existing one.


The documentation for this class was generated from the following files: