azure-sdk-for-cpp/sdk/core/azure-core-amqp
James Le Cuirot a091f4c8e0
Set VERSION property against all libraries to write versioned SONAME (#6087)
The SONAME currently written to shared libraries is unversioned, e.g.
libazure-core.so. The SDK's ABI is unstable, so replacing these .so
files with newer versions will immediately break any consumers.

Setting the VERSION property results in libazure-core.so being a symlink
that is used at build time to point to the versioned library, e.g.
libazure-core.so.1.14.0. Consumers point directly to the versioned
library and continue to work against the older version when the library
is upgraded. Once rebuilt, they then point to the newer version instead.

It is more common to use an ABI version that is separate to the library
version, but it makes sense to use the latter when the ABI is unstable.
The Boost libraries do exactly this.

This change has no effect on static libraries, which is the more common
use case. See the CMake documentation for its wider effects.

https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html
2024-10-11 11:42:13 -07:00
..
inc Fixed #5536, fixed a test deadlock discovered while testing the fix for 5536, added some diagnostics for uAMQP to help track the problem. (#5651) 2024-05-22 11:39:03 -07:00
samples Use code snippets from managed identity credential samples in identity readme doc and fix minor generation issues (#6020) 2024-09-25 16:56:57 -07:00
src Increment version for core releases (#5980) 2024-09-12 11:22:35 -07:00
test Add consumption-time value of __cplusplus to User-Agent (#5662) 2024-07-29 18:31:51 -07:00
vcpkg Undo unnecessary Core vcpkg dependency version bump (#5860) 2024-07-31 22:23:29 +00:00
vendor/azure-uamqp-c V2 of integrating uAMQP vixes into vendored copy (#5931) 2024-08-21 12:19:31 -07:00
cgmanifest.json Small cleanup around AMQP dependencies (#5083) 2023-10-28 22:28:51 +00:00
CHANGELOG.md Increment version for core releases (#5980) 2024-09-12 11:22:35 -07:00
CMakeLists.txt Set VERSION property against all libraries to write versioned SONAME (#6087) 2024-10-11 11:42:13 -07:00
cspell.json AMQP Session related fixes. (#5299) 2024-01-30 15:32:58 -08:00
NOTICE.txt
README.md Use code snippets from managed identity credential samples in identity readme doc and fix minor generation issues (#6020) 2024-09-25 16:56:57 -07:00
vcpkg.json Vendor AMQP at commit 52942afb1a4b48a1d8af7a3ac37d3211661e3423 (#5049) 2023-10-25 11:19:20 -07:00

Azure SDK AMQP Library for C++

Azure::Core::Amqp (azure-core-amqp) provides an implementation to enable developers to create Azure SDKs which consume the AMQP protocol. Note that this is NOT a general purpose AMQP library, it is intended solely for the purposes of building Azure C++ SDK clients which communicate with Azure services over AMQP.

Getting started

Include the package

The easiest way to acquire the AMQP library is leveraging vcpkg package manager. See the corresponding Azure SDK for C++ readme section.

To install Azure Core AMQP package via vcpkg:

> vcpkg install azure-core-amqp-cpp

Then, use in your CMake file:

find_package(azure-core-amqp-cpp CONFIG REQUIRED)
target_link_libraries(<your project name> PRIVATE Azure::azure-core-amqp)

Key concepts

The AMQP Protocol is a relatively complicated protocol which is used by Azure services to communicate with clients. This library provides a set of classes which can be used to build Azure SDK clients which communicate with Azure services over AMQP.

The AMQP library provides the following classes:

  • AmqpClient - The basic client used to communicate with the AMQP server.
  • MessageSender - A class which is used to send messages to an AMQP server.
  • MessageReceiver - A class which is used to receive messages from an AMQP server.

Examples

Create an AMQP Message Sender

An AMQP Message Sender is responsible for sending messages to an AMQP server over an AMQP Session.

Azure::Core::Amqp::_internal::MessageSenderOptions senderOptions;
senderOptions.Name = "sender-link";
senderOptions.MessageSource = "source";
senderOptions.SettleMode = Azure::Core::Amqp::_internal::SenderSettleMode::Unsettled;
senderOptions.MaxMessageSize = (std::numeric_limits<uint16_t>::max)();

Azure::Core::Amqp::_internal::MessageSender sender(
    session, credentials->GetEntityPath(), senderOptions, nullptr);

Once the message sender has been created, it can be used to send messages to the remote server.

Azure::Core::Amqp::Models::AmqpMessage message;
message.SetBody(Azure::Core::Amqp::Models::AmqpBinaryData{'H', 'e', 'l', 'l', 'o'});

constexpr int maxMessageSendCount = 5;

int messageSendCount = 0;
while (messageSendCount < maxMessageSendCount)
{
  auto result = sender.Send(message);
  messageSendCount += 1;
}

Next steps

You can build and run the tests locally by executing azure-core-amqp-test. Explore the test folder to see advanced usage and behavior of the public classes.

Troubleshooting

If you run into issues while using this library, please feel free to file an issue.

Reporting security issues and security bugs

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

License

Azure SDK for C++ is licensed under the MIT license.

Impressions