1 /** 2 * DeferredExtReceiver.h 3 * 4 * Extended receiver that _wants_ to receive message (because it is 5 * consuming or get'ting messages. This is the base class for both 6 * the DeferredConsumer as well as the DeferredGet classes, but not 7 * the base of the DeferredPublisher (which can also receive returned 8 * messages, but not as a result of an explicit request) 9 * 10 * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> 11 * @copyright 2018 Copernica BV 12 */ 13 14 /** 15 * Include guard 16 */ 17 #pragma once 18 19 /** 20 * Dependencies 21 */ 22 #include "deferredreceiver.h" 23 24 /** 25 * Begin of namespace 26 */ 27 namespace AMQP { 28 29 /** 30 * Class definition 31 */ 32 class DeferredExtReceiver : public DeferredReceiver 33 { 34 protected: 35 /** 36 * The delivery tag for the current message 37 * @var uint64_t 38 */ 39 uint64_t _deliveryTag = 0; 40 41 /** 42 * Is this a redelivered message 43 * @var bool 44 */ 45 bool _redelivered = false; 46 47 /** 48 * Callback for incoming messages 49 * @var MessageCallback 50 */ 51 MessageCallback _messageCallback; 52 53 /** 54 * Callback for when a message was complete finished 55 * @var DeliveredCallback 56 */ 57 DeliveredCallback _deliveredCallback; 58 59 60 /** 61 * Initialize the object to send out a message 62 * @param exchange the exchange to which the message was published 63 * @param routingkey the routing key that was used to publish the message 64 */ 65 virtual void initialize(const std::string &exchange, const std::string &routingkey) override; 66 67 /** 68 * Indicate that a message was done 69 */ 70 virtual void complete() override; 71 72 /** 73 * Constructor 74 * @param failed Have we already failed? 75 * @param channel The channel we are consuming on 76 */ DeferredExtReceiver(bool failed,ChannelImpl * channel)77 DeferredExtReceiver(bool failed, ChannelImpl *channel) : 78 DeferredReceiver(failed, channel) {} 79 80 public: 81 /** 82 * Destructor 83 */ 84 virtual ~DeferredExtReceiver() = default; 85 }; 86 87 /** 88 * End of namespace 89 */ 90 } 91 92