azure-messaging-eventhubs
Loading...
Searching...
No Matches
partition_client.hpp
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3#pragma once
4#include "eventhubs_exception.hpp"
5#include "models/event_data.hpp"
6#include "models/partition_client_models.hpp"
7
8#include <azure/core/amqp.hpp>
9#include <azure/core/amqp/internal/message_receiver.hpp>
10#include <azure/core/datetime.hpp>
11#include <azure/core/http/policies/policy.hpp>
12#include <azure/core/nullable.hpp>
13
14namespace Azure { namespace Messaging { namespace EventHubs {
15 namespace _detail {
16 class PartitionClientFactory;
17 }
22 {
32
38 Azure::Nullable<std::int64_t> OwnerLevel{};
39
50 int32_t Prefetch = 300;
51 };
52
58 class PartitionClient final {
59
60 public:
62 PartitionClient(PartitionClient const& other) = delete;
64 PartitionClient(PartitionClient&& other) = default;
65
67 PartitionClient& operator=(PartitionClient const& other) = delete;
70
73 virtual ~PartitionClient();
74
82 std::vector<std::shared_ptr<const Models::ReceivedEventData>> ReceiveEvents(
83 uint32_t maxMessages,
84 Core::Context const& context = {});
85
88 void Close(Core::Context const& context) { m_receiver.Close(context); }
89
90 private:
91 friend class _detail::PartitionClientFactory;
93 Azure::Core::Amqp::_internal::MessageReceiver m_receiver;
94
96 PartitionClientOptions m_partitionOptions;
97
99 // std::string m_partitionId;
100
104 Azure::Core::Http::Policies::RetryOptions m_retryOptions{};
105
113 PartitionClient(
114 Azure::Core::Amqp::_internal::MessageReceiver const& messageReceiver,
115 PartitionClientOptions options,
116 Core::Http::Policies::RetryOptions retryOptions);
117
118 std::string GetStartExpression(Models::StartPosition const& startPosition);
119 };
120}}} // namespace Azure::Messaging::EventHubs
Definition partition_client.hpp:58
PartitionClient(PartitionClient &&other)=default
Create a PartitionClient moving from another PartitionClient.
virtual ~PartitionClient()
Definition partition_client.cpp:174
std::vector< std::shared_ptr< const Models::ReceivedEventData > > ReceiveEvents(uint32_t maxMessages, Core::Context const &context={})
Definition partition_client.cpp:188
PartitionClient & operator=(PartitionClient const &other)=delete
Assign a PartitionClient to another PartitionClient.
PartitionClient & operator=(PartitionClient &&other)=default
Move a PartitionClient to another PartitionClient.
PartitionClient(PartitionClient const &other)=delete
Create a PartitionClient from another PartitionClient.
void Close(Core::Context const &context)
Closes the connection to the Event Hub service.
Definition partition_client.hpp:88
StartPosition indicates the position to start receiving events within a partition....
Definition partition_client_models.hpp:18
Definition partition_client.hpp:22
Azure::Nullable< std::int64_t > OwnerLevel
OwnerLevel is the priority for this partition client, also known as the 'epoch' level....
Definition partition_client.hpp:38
int32_t Prefetch
Prefetch represents the size of the internal prefetch buffer. When set, this client will attempt to a...
Definition partition_client.hpp:50
Models::StartPosition StartPosition
StartPosition is the position we will start receiving events from, either an offset (inclusive) with ...
Definition partition_client.hpp:31