2018-03-02 04:12:50 +08:00
|
|
|
/**
|
|
|
|
|
* DeferredPublisher.cpp
|
|
|
|
|
*
|
|
|
|
|
* Implementation file for the DeferredPublisher class
|
|
|
|
|
*
|
|
|
|
|
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
|
|
|
|
|
* @copyright 2018 Copernica BV
|
|
|
|
|
*/
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Begin of namespace
|
|
|
|
|
*/
|
|
|
|
|
namespace AMQP {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicate that a message was done
|
|
|
|
|
*/
|
|
|
|
|
void DeferredPublisher::complete()
|
|
|
|
|
{
|
|
|
|
|
// also monitor the channel
|
|
|
|
|
Monitor monitor(_channel);
|
|
|
|
|
|
|
|
|
|
// do we have a message?
|
2018-03-02 04:12:53 +08:00
|
|
|
if (_message) _bounceCallback(*_message, _code, _description);
|
2018-03-02 04:12:50 +08:00
|
|
|
|
|
|
|
|
// do we have to inform anyone about completion?
|
|
|
|
|
if (_completeCallback) _completeCallback();
|
|
|
|
|
|
|
|
|
|
// for the next iteration we want a new message
|
|
|
|
|
_message.reset();
|
|
|
|
|
|
|
|
|
|
// do we still have a valid channel
|
|
|
|
|
if (!monitor.valid()) return;
|
|
|
|
|
|
|
|
|
|
// we are now done executing, so the channel can forget the current receiving object
|
|
|
|
|
_channel->install(nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* End of namespace
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|