7#include "models/consumer_client_models.hpp"
8#include "models/management_models.hpp"
9#include "partition_client.hpp"
11#include <azure/core/amqp.hpp>
12#include <azure/core/amqp/internal/connection.hpp>
13#include <azure/core/context.hpp>
14#include <azure/core/credentials/credentials.hpp>
15#include <azure/core/diagnostics/logger.hpp>
16#include <azure/core/http/policies/policy.hpp>
17#include <azure/core/internal/diagnostics/log.hpp>
18namespace Azure {
namespace Messaging {
namespace EventHubs {
21 constexpr const char* DefaultConsumerGroup =
"$Default";
116 std::string
const& connectionString,
117 std::string
const& eventHub = {},
118 std::string
const& consumerGroup = DefaultConsumerGroup,
119 ConsumerClientOptions
const& options = {});
132 std::string
const& fullyQualifiedNamespace,
133 std::string
const& eventHub,
134 std::shared_ptr<Azure::Core::Credentials::TokenCredential> credential,
135 std::string
const& consumerGroup = DefaultConsumerGroup,
136 ConsumerClientOptions
const& options = {});
145 std::string
const& partitionId,
146 PartitionClientOptions
const& options = {},
147 Azure::Core::Context
const& context = {});
163 std::string
const& partitionID,
164 Core::Context
const& context = {});
168 std::string m_connectionString;
171 std::string m_fullyQualifiedNamespace;
174 std::string m_eventHub;
177 std::string m_consumerGroup;
180 std::shared_ptr<Core::Credentials::TokenCredential> m_credential;
183 std::string m_hostUrl;
186 std::mutex m_receiversLock;
187 std::map<std::string, Azure::Core::Amqp::_internal::MessageReceiver> m_receivers;
190 std::mutex m_sessionsLock;
191 std::map<std::string, Azure::Core::Amqp::_internal::Session> m_sessions;
192 std::map<std::string, Azure::Core::Amqp::_internal::Connection> m_connections;
195 ConsumerClientOptions m_consumerClientOptions;
197 void EnsureConnection(std::string
const& partitionId);
198 void EnsureSession(std::string
const& partitionId);
199 Azure::Core::Amqp::_internal::Connection CreateConnection(std::string
const& partitionId)
const;
200 Azure::Core::Amqp::_internal::Session CreateSession(std::string
const& partitionId);
201 Azure::Core::Amqp::_internal::Session GetSession(std::string
const& partitionId);
The ConsumerClient class is a high level class used to consume events from an Event Hub.
Definition consumer_client.hpp:49
ConsumerClient & operator=(ConsumerClient const &other)=delete
Models::EventHubPartitionProperties GetPartitionProperties(std::string const &partitionID, Core::Context const &context={})
GetPartitionProperties gets properties for a specific partition. This includes data like the last enq...
Definition consumer_client.cpp:151
std::string const & GetConsumerGroup() const
Getter for consumer group name.
Definition consumer_client.hpp:75
PartitionClient CreatePartitionClient(std::string const &partitionId, PartitionClientOptions const &options={}, Azure::Core::Context const &context={})
Create new Partition client.
Definition consumer_client.cpp:124
ConsumerClient(ConsumerClient &&other)=delete
ConsumerClient & operator=(ConsumerClient &&other)=delete
ConsumerClient(ConsumerClient const &other)=delete
Models::EventHubProperties GetEventHubProperties(Core::Context const &context={})
GetEventHubProperties gets properties of an eventHub. This includes data like name,...
Definition consumer_client.cpp:143
std::string const & GetEventHubName() const
Getter for event hub name.
Definition consumer_client.hpp:69
Models::ConsumerClientDetails GetDetails() const
Getter for client details.
Definition consumer_client.hpp:81
Azure::Core::Http::Policies::RetryOptions const & GetRetryOptions() const
Getter for retry options.
Definition consumer_client.hpp:94
Contains options for the ConsumerClient creation.
Definition consumer_client.hpp:26
std::string ApplicationID
ApplicationID is used as the identifier when setting the User-Agent property.
Definition consumer_client.hpp:29
Azure::Core::Http::Policies::RetryOptions RetryOptions
RetryOptions controls how often operations are retried from this client and any Receivers and Senders...
Definition consumer_client.hpp:34
std::string Name
Name of the consumer client.
Definition consumer_client.hpp:37
Contains options for the ConsumerClient creation.
Definition consumer_client_models.hpp:13
std::string ClientId
A unique name used to identify this consumer.
Definition consumer_client_models.hpp:29
std::string FullyQualifiedNamespace
The Fully Qualified Namespace that the Event Hub exists in.
Definition consumer_client_models.hpp:16
std::string ConsumerGroup
The name of the consumer group that this consumer is associated with. Events will be read only in the...
Definition consumer_client_models.hpp:21
std::string EventHubName
The name of the Event Hub that the consumer is connected to.
Definition consumer_client_models.hpp:25