AMQP-CPP 2.1.4
This release contains a number of changes in the behavior of some classes and functions, and a new feature.
Fixed issues with Channel.get() and Channel.purgeQueue()
The Channel.get() and Channel.purgeQueue() methods always reported an error, even when nothing was wrong with the calls. This has been fixed.
Copy'ing of Connection and Channel objects has been disabled
The AMQP-CPP library no longer allows users to copy Connection or Channel objects. These two classes were never intended to be copyable, but technically it was still possible to do so (although this would probably end in either a crash or unexpected behavior). Now it is also technically impossible, and will be detected at compile time, because the copy constructors of the two classes have been deleted.
New Channel.get().onSize() method
When you call the Channel.get() function, the deferred object that is returned (and that you normally use to call the onReceived() or onMessage() methods on to install a callback for handling the message) now also has an onSize() method. This onSize() method will be called right before the message-callback is called, with the new number of messages in the queue.
channel.get("my-queue").onReceived([](const Message &message, uint64_t deliveryTag, bool redelivered) {
// @todo process the message
}).onSize([](uint32_t messagecount) {
std::cout << messagecount << " message remain in the queue" << std::endl;
});
Be aware that the queue-size callback function will be called before the message is received, but that the messagecount parameter holds the new queue size (without the message that is fetched from it).
Change order for onFinalize() calls
In some situations, the callback registered with onFinalize() was called before one of the other registered callbacks was called. This happened especially with the Channel.get() call. This has been fixed: the onFinalize() call will now always be called after the callbacks registered with onSize(), onMessage() and onEmpty() were invoked.