AMQP-CPP/src/consumedmessage.h

68 lines
1.1 KiB
C
Raw Normal View History

2014-01-06 22:49:31 +08:00
/**
* Base class for a message implementation
*
* @copyright 2014 Copernica BV
*/
/**
* Set up namespace
*/
namespace AMQP {
/**
* Class definition
*/
class ConsumedMessage : public MessageImpl
{
private:
/**
* The consumer tag
* @var string
*/
std::string _consumerTag;
/**
* The delivery tag
* @var uint64_t
*/
uint64_t _deliveryTag;
2014-01-06 22:49:31 +08:00
/**
* Is this a redelivered message?
* @var bool
*/
bool _redelivered;
public:
/**
* Constructor
* @param frame
*/
ConsumedMessage(const BasicDeliverFrame &frame) :
MessageImpl(frame.exchange(), frame.routingKey()),
2014-01-06 22:49:31 +08:00
_consumerTag(frame.consumerTag()), _deliveryTag(frame.deliveryTag()), _redelivered(frame.redelivered())
{}
2014-01-06 22:49:31 +08:00
/**
* Destructor
*/
virtual ~ConsumedMessage() {}
2014-01-06 22:49:31 +08:00
/**
* Report to the handler
* @param consumer
2014-01-06 22:49:31 +08:00
*/
virtual void report(const DeferredConsumer& consumer) override
2014-01-06 22:49:31 +08:00
{
// send ourselves to the consumer
consumer.message(*this, _deliveryTag, _consumerTag, _redelivered);
2014-01-06 22:49:31 +08:00
}
};
/**
* End of namespace
*/
}