7#include "event_data_batch.hpp"
8#include "models/management_models.hpp"
10#include <azure/core/amqp.hpp>
11#include <azure/core/amqp/internal/management.hpp>
12#include <azure/core/amqp/internal/message_sender.hpp>
13#include <azure/core/context.hpp>
14#include <azure/core/credentials/credentials.hpp>
15#include <azure/core/http/policies/policy.hpp>
19namespace Azure {
namespace Messaging {
namespace EventHubs {
76 std::string
const& connectionString,
77 std::string
const& eventHub,
88 std::string
const& fullyQualifiedNamespace,
89 std::string
const& eventHub,
90 std::shared_ptr<Azure::Core::Credentials::TokenCredential> credential,
95 for (
auto& sender : m_senders)
97 sender.second.Close();
110 EventDataBatchOptions
const& options = {},
111 Azure::Core::Context
const& context = {});
118 void Send(EventDataBatch
const& eventDataBatch, Core::Context
const& context = {});
128 void Send(Models::EventData
const& eventData, Core::Context
const& context = {});
138 void Send(std::vector<Models::EventData>
const& eventData, Core::Context
const& context = {});
155 std::string
const& partitionID,
156 Core::Context
const& context = {});
160 std::string m_connectionString;
163 std::string m_fullyQualifiedNamespace;
166 std::string m_eventHub{};
169 std::string m_targetUrl{};
172 std::shared_ptr<Core::Credentials::TokenCredential> m_credential{};
174 ProducerClientOptions m_producerClientOptions{};
177 std::mutex m_sendersLock;
178 std::map<std::string, Azure::Core::Amqp::_internal::Connection> m_connections{};
179 std::map<std::string, Azure::Core::Amqp::_internal::MessageSender> m_senders{};
181 std::mutex m_sessionsLock;
182 std::map<std::string, Azure::Core::Amqp::_internal::Session> m_sessions{};
184 Azure::Core::Amqp::_internal::Connection CreateConnection()
const;
185 Azure::Core::Amqp::_internal::Session CreateSession(std::string
const& partitionId);
188 void EnsureConnection(
const std::string& partitionId);
191 void EnsureSession(std::string
const& partitionId);
194 void EnsureSender(std::string
const& partitionId, Azure::Core::Context
const& context = {});
196 Azure::Core::Amqp::_internal::MessageSender GetSender(std::string
const& partitionId);
197 Azure::Core::Amqp::_internal::Session GetSession(std::string
const& partitionId);
ProducerClient can be used to send events to an Event Hub.
Definition producer_client.hpp:45
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 producer_client.cpp:202
Azure::Core::Http::Policies::RetryOptions const & GetRetryOptions() const
Definition producer_client.hpp:52
ProducerClient & operator=(ProducerClient const &other)=delete
ProducerClient(ProducerClient const &other)=delete
std::string const & GetEventHubName()
Definition producer_client.hpp:49
EventDataBatch CreateBatch(EventDataBatchOptions const &options={}, Azure::Core::Context const &context={})
Create a new EventDataBatch to be sent to the Event Hub.
Definition producer_client.cpp:50
void Send(EventDataBatch const &eventDataBatch, Core::Context const &context={})
Send an EventDataBatch to the remote Event Hub.
Definition producer_client.cpp:66
Models::EventHubProperties GetEventHubProperties(Core::Context const &context={})
GetEventHubProperties gets properties of an eventHub. This includes data like name,...
Definition producer_client.cpp:193
Contains options for the ProducerClient creation.
Definition producer_client.hpp:24
Azure::Core::Http::Policies::RetryOptions RetryOptions
RetryOptions controls how often operations are retried from this client and any Receivers and Senders...
Definition producer_client.hpp:32
Azure::Nullable< std::uint64_t > MaxMessageSize
The maximum size of the message that can be sent.
Definition producer_client.hpp:40
std::string Name
The name of the producer client link, used in diagnostics.
Definition producer_client.hpp:36
std::string ApplicationID
Application ID that will be passed to the namespace.
Definition producer_client.hpp:27