From c93f2d89ac64fe7377bccbc6c3673dbc1189be04 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 11 Sep 2022 20:09:02 +0200 Subject: [PATCH] when destructing a Tagger class, we now also unset the error-callback (closes #480), at the same time we changed the version number in the Makefile (closes #481) --- Makefile | 2 +- include/amqpcpp/reliable.h | 10 +++++++--- include/amqpcpp/tagger.h | 11 +++++++++-- src/tagger.cpp | 9 +++++++++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f092f14..765cfdf 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ INCLUDE_DIR = ${PREFIX}/include LIBRARY_DIR = ${PREFIX}/lib export LIBRARY_NAME = amqpcpp export SONAME = 4.3 -export VERSION = 4.3.15 +export VERSION = 4.3.17 all: $(MAKE) -C src all diff --git a/include/amqpcpp/reliable.h b/include/amqpcpp/reliable.h index 2a29874..a084299 100644 --- a/include/amqpcpp/reliable.h +++ b/include/amqpcpp/reliable.h @@ -1,11 +1,15 @@ /** * Reliable.h * - * A channel wrapper based on AMQP::Throttle that allows message callbacks to be installed - * on the publishes, to be called when they are confirmed by the message broker. + * A channel wrapper based on AMQP::Tagger that allows message callbacks to be installed + * on the publish-confirms, to be called when they a confirmation is received from RabbitMQ. + * + * You can also change the base class and use Reliable if you not only + * want to be notified about the publish-confirms, but want to use it for automatic + * throttling at the same time. * * @author Michael van der Werve - * @copyright 2020 Copernica BV + * @copyright 2020 - 2022 Copernica BV */ /** diff --git a/include/amqpcpp/tagger.h b/include/amqpcpp/tagger.h index 5d472a1..f591908 100644 --- a/include/amqpcpp/tagger.h +++ b/include/amqpcpp/tagger.h @@ -1,7 +1,14 @@ /** * Tagger.h * - * Base class that enables publisher confirms and keeps track of the sent messages. + * Base class that enables publisher confirms and keeps track of the sent + * messages. You can wrap this class around a AMQP::Channel object and use + * this object for publishing instead. This is a base class that you cannot + * use directly. You should instead use: + * + * - Throttle: to throttle traffic to prevent flooding RabbitMQ + * - Reliable: to be notified about publish-confirms via callbacks + * - Reliable: to have throttle + notifications via callbacks * * @author Michael van der Werve * @copyright 2020 Copernica BV @@ -101,7 +108,7 @@ public: /** * Virtual destructor */ - virtual ~Tagger() = default; + virtual ~Tagger(); /** * Method to check how many messages are still unacked. diff --git a/src/tagger.cpp b/src/tagger.cpp index 03f38e0..58e21cf 100644 --- a/src/tagger.cpp +++ b/src/tagger.cpp @@ -38,6 +38,15 @@ Tagger::Tagger(Channel &channel) : _implementation(channel._implementation) _implementation->onError([this](const char *message) { reportError(message); }); } +/** + * Destructor + */ +Tagger::~Tagger() +{ + // restore the error-callback + _implementation->onError(nullptr); +} + /** * Send method for a frame * @param id