2014-04-15 17:39:52 +08:00
|
|
|
/**
|
|
|
|
|
* DeferredConsumer.cpp
|
|
|
|
|
*
|
|
|
|
|
* Implementation file for the DeferredConsumer class
|
|
|
|
|
*
|
|
|
|
|
* @copyright 2014 Copernica BV
|
|
|
|
|
*/
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Namespace
|
|
|
|
|
*/
|
|
|
|
|
namespace AMQP {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Report success for frames that report start consumer operations
|
|
|
|
|
* @param name Consumer tag that is started
|
|
|
|
|
* @return Deferred
|
|
|
|
|
*/
|
2014-09-02 16:32:55 +08:00
|
|
|
const std::shared_ptr<Deferred> &DeferredConsumer::reportSuccess(const std::string &name) const
|
2014-04-15 17:39:52 +08:00
|
|
|
{
|
|
|
|
|
// we now know the name, so we can install the message callback on the channel
|
|
|
|
|
_channel->install(name, _messageCallback);
|
|
|
|
|
|
|
|
|
|
// skip if no special callback was installed
|
|
|
|
|
if (!_consumeCallback) return Deferred::reportSuccess();
|
|
|
|
|
|
|
|
|
|
// call the callback
|
|
|
|
|
_consumeCallback(name);
|
|
|
|
|
|
|
|
|
|
// return next object
|
|
|
|
|
return _next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* End namespace
|
|
|
|
|
*/
|
|
|
|
|
}
|