File: deferredextreceiver.h

package info (click to toggle)
amqp-cpp 4.3.27-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,384 kB
  • sloc: cpp: 10,021; ansic: 191; makefile: 95
file content (91 lines) | stat: -rw-r--r-- 2,040 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
 *  DeferredExtReceiver.h
 *
 *  Extended receiver that _wants_ to receive message (because it is
 *  consuming or get'ting messages. This is the base class for both
 *  the DeferredConsumer as well as the DeferredGet classes, but not
 *  the base of the DeferredRecall (which can also receive returned
 *  messages, but not as a result of an explicit request)
 *  
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2018 - 2020 Copernica BV
 */

/**
 *  Include guard
 */
#pragma once

/**
 *  Dependencies
 */
#include "deferredreceiver.h"

/**
 *  Begin of namespace
 */
namespace AMQP {

/**
 *  Class definition
 */
class DeferredExtReceiver : public DeferredReceiver
{
protected:
    /**
     *  The delivery tag for the current message
     *  @var    uint64_t
     */
    uint64_t _deliveryTag = 0;

    /**
     *  Is this a redelivered message
     *  @var    bool
     */
    bool _redelivered = false;

    /**
     *  Callback for incoming messages
     *  @var    MessageCallback
     */
    MessageCallback _messageCallback;

    /**
     *  Callback for when a message was complete finished
     *  @var    DeliveredCallback
     */
    DeliveredCallback _deliveredCallback;


    /**
     *  Initialize the object to send out a message
     *  @param  exchange            the exchange to which the message was published
     *  @param  routingkey          the routing key that was used to publish the message
     */
    virtual void initialize(const std::string &exchange, const std::string &routingkey) override;

    /**
     *  Indicate that a message was done
     */
    virtual void complete() override;

    /**
     *  Constructor
     *  @param  failed  Have we already failed?
     *  @param  channel The channel we are consuming on
     */
    DeferredExtReceiver(bool failed, ChannelImpl *channel) : 
        DeferredReceiver(failed, channel) {}
    
public:
    /**
     *  Destructor
     */
    virtual ~DeferredExtReceiver() = default;
};
    
/**
 *  End of namespace
 */
}