6#include "azure/core/amqp/internal/amqp_settle_mode.hpp"
7#include "azure/core/amqp/internal/models/amqp_error.hpp"
8#include "azure/core/amqp/models/amqp_message.hpp"
9#include "azure/core/amqp/models/amqp_value.hpp"
10#include "claims_based_security.hpp"
11#include "common/async_operation_queue.hpp"
12#include "connection_string_credential.hpp"
16#include <azure/core/credentials/credentials.hpp>
17#include <azure/core/nullable.hpp>
21namespace Azure {
namespace Core {
namespace Amqp {
namespace _detail {
22 class MessageReceiverImpl;
23 class MessageReceiverFactory;
26#if defined(_azure_TESTING_BUILD)
27namespace Azure {
namespace Core {
namespace Amqp {
namespace Tests {
namespace MessageTests {
28 class MockServiceEndpoint;
32namespace Azure {
namespace Core {
namespace Amqp {
namespace _internal {
33 enum class MessageReceiverState
42 std::ostream& operator<<(std::ostream& stream, _internal::MessageReceiverState state);
44 class MessageReceiver;
46 struct MessageReceiverOptions final
68 ReceiverSettleMode SettleMode{ReceiverSettleMode::First};
71 Models::_internal::MessageTarget MessageTarget;
74 Nullable<uint32_t> InitialDeliveryCount;
77 Nullable<uint64_t> MaxMessageSize;
82 uint32_t MaxLinkCredit{};
85 Models::AmqpMap Properties;
88 bool EnableTrace{
false};
91 bool AuthenticationRequired{
true};
94 class MessageReceiverEvents {
96 ~MessageReceiverEvents() =
default;
99 virtual void OnMessageReceiverStateChanged(
100 MessageReceiver
const& receiver,
101 MessageReceiverState newState,
102 MessageReceiverState oldState)
104 virtual Models::AmqpValue OnMessageReceived(
105 MessageReceiver
const& receiver,
106 std::shared_ptr<Models::AmqpMessage>
const& message)
108 virtual void OnMessageReceiverDisconnected(
109 MessageReceiver
const& receiver,
110 Models::_internal::AmqpError
const& error)
136 class MessageReceiver final {
138 ~MessageReceiver() noexcept;
140 MessageReceiver(MessageReceiver const&) = default;
141 MessageReceiver& operator=(MessageReceiver const&) = default;
142 MessageReceiver(MessageReceiver&&) = default;
143 MessageReceiver& operator=(MessageReceiver&&) = default;
149 void Open(Context const& context = {});
154 void Close(Context
const& context = {});
160 std::string GetLinkName()
const;
166 std::string GetSourceName()
const;
174 std::pair<std::shared_ptr<const Models::AmqpMessage>, Models::_internal::AmqpError>
175 WaitForIncomingMessage(Context
const& context = {});
182 std::pair<std::shared_ptr<const Models::AmqpMessage>, Models::_internal::AmqpError>
183 TryWaitForIncomingMessage();
186 MessageReceiver(std::shared_ptr<_detail::MessageReceiverImpl> impl) : m_impl{impl} {}
187 friend class _detail::MessageReceiverFactory;
188 std::shared_ptr<_detail::MessageReceiverImpl> m_impl;
190#if _azure_TESTING_BUILD
191 friend class Azure::Core::Amqp::Tests::MessageTests::MockServiceEndpoint;
199 void EnableLinkPolling();