azure-core-amqp
Loading...
Searching...
No Matches
message_target.hpp
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#pragma once
5
6#include "azure/core/amqp/models/amqp_header.hpp"
7#include "azure/core/amqp/models/amqp_properties.hpp"
8#include "azure/core/amqp/models/amqp_value.hpp"
9
10namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace _detail {
11 class MessageTargetImpl;
12}}}}} // namespace Azure::Core::Amqp::Models::_detail
13
14namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace _internal {
15
16 struct MessageTargetOptions final
17 {
18 AmqpValue Address;
19 Nullable<TerminusDurability> TerminusDurabilityValue;
20 Nullable<TerminusExpiryPolicy> TerminusExpiryPolicyValue;
21 Nullable<std::chrono::system_clock::time_point> Timeout;
22 Nullable<bool> Dynamic;
23 AmqpMap DynamicNodeProperties;
24 AmqpArray Capabilities;
25 };
26
37 class MessageTarget final {
38 public:
41 MessageTarget();
43 ~MessageTarget();
44
46 MessageTarget(MessageTarget const& that);
47
49 MessageTarget& operator=(MessageTarget const& that);
50
52 MessageTarget(MessageTarget&&) noexcept;
53
55 MessageTarget& operator=(MessageTarget&&) noexcept;
56
57 /* Note: These constructors should NOT be marked as explicit, because we want to enable the
58 * implicit construction of the MessageTarget from a string - this allows callers to construct
59 * Link, MessageSender, and MessageReceiver objects without forcing the creation of a
60 * MessageSource object. */
61
66 MessageTarget(std::string const& address);
67
72 MessageTarget(char const* address);
73
78 MessageTarget(MessageTargetOptions const& options);
79
86 MessageTarget(Models::AmqpValue const& value);
87
93 AmqpValue AsAmqpValue() const;
94
104 AmqpValue GetAddress() const;
105
113 TerminusDurability GetTerminusDurability() const;
114
122 TerminusExpiryPolicy GetExpiryPolicy() const;
123
131 std::chrono::system_clock::time_point GetTimeout() const;
132
140 bool GetDynamic() const;
141
153 AmqpMap GetDynamicNodeProperties() const;
154
162 AmqpArray GetCapabilities() const;
163
164 private:
165 std::unique_ptr<_detail::MessageTargetImpl> m_impl;
166
167 // Declared as friend so it can use the TARGET_INSTANCE_TAG* overload.
168 friend std::ostream& operator<<(std::ostream&, MessageTarget const&);
169 };
170
171}}}}} // namespace Azure::Core::Amqp::Models::_internal