diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 8aa8bbee..0bd77350 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -589,6 +589,24 @@ DeferredConsumer& ChannelImpl::consume(const std::string &queue, const std::stri return *deferred; } +/** + * Tell that you are prepared to recall/take back messages that could not be + * published. This is only meaningful if you pass the 'immediate' or 'mandatory' + * flag to publish() operations. + * + * THis function returns a deferred handler more or less similar to the object + * return by the consume() method and that can be used to install callbacks that + * handle the recalled messages. + */ +DeferredRecall &ChannelImpl::recall() +{ + // create the DeferredRecall if it does not exist + if (!_recall) _recall = std::make_shared(this); + + // return the deferred handler + return *_recall; +} + /** * Cancel a running consumer * @param tag the consumer tag