Remove messageCounter()
This commit is contained in:
parent
bfd91b6ab5
commit
e0b04ad7e0
|
|
@ -986,8 +986,6 @@ once).
|
||||||
|
|
||||||
If server is unable to process a message, it will send send negative acknowledgments. Both
|
If server is unable to process a message, it will send send negative acknowledgments. Both
|
||||||
positive and negative acknowledgments handling are implemented as callbacks for Channel object.
|
positive and negative acknowledgments handling are implemented as callbacks for Channel object.
|
||||||
There is also helper method messageCounter() that returns number of messages send so far
|
|
||||||
(note that this value is reset when channel is put in confirm mode).
|
|
||||||
|
|
||||||
````c++
|
````c++
|
||||||
// setup ack and nack callbacks
|
// setup ack and nack callbacks
|
||||||
|
|
@ -1005,10 +1003,10 @@ channel.onNack([&](uint64 deliveryTag, bool multiple, bool requeue) {
|
||||||
// put channel in confirm mode
|
// put channel in confirm mode
|
||||||
channel.setConfirmMode().onSuccess([&]() {
|
channel.setConfirmMode().onSuccess([&]() {
|
||||||
channel.publish("my-exchange", "my-key", "my first message");
|
channel.publish("my-exchange", "my-key", "my first message");
|
||||||
// channel.messageCounter() is now 1, will call onAck/onNack with deliverTag=1
|
// message counter is now 1, will call onAck/onNack with deliverTag=1
|
||||||
|
|
||||||
channel.publish("my-exchange", "my-key", "my second message");
|
channel.publish("my-exchange", "my-key", "my second message");
|
||||||
// channel.messageCounter() is now 2, will call onAck/onNack with deliverTag=2
|
// message counter is now 2, will call onAck/onNack with deliverTag=2
|
||||||
});
|
});
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,17 +138,6 @@ public:
|
||||||
return _implementation->setConfirmMode();
|
return _implementation->setConfirmMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return number of messages sent.
|
|
||||||
*
|
|
||||||
* This functions returns number of messages sent. It's reset to zero when channel is
|
|
||||||
* put into confirm mode.
|
|
||||||
*/
|
|
||||||
uint64_t messageCounter() const
|
|
||||||
{
|
|
||||||
return _implementation->messageCounter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback that is called when the broker confirmed message publication
|
* Callback that is called when the broker confirmed message publication
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -141,12 +141,6 @@ private:
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<DeferredReceiver> _receiver;
|
std::shared_ptr<DeferredReceiver> _receiver;
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of messages sent. Used in confirm mode
|
|
||||||
* @var uint64_t
|
|
||||||
*/
|
|
||||||
uint64_t _messageCounter = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback when broker confirmed message publication
|
* Callback when broker confirmed message publication
|
||||||
* @var SuccessCallback
|
* @var SuccessCallback
|
||||||
|
|
@ -295,14 +289,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Deferred &setConfirmMode();
|
Deferred &setConfirmMode();
|
||||||
|
|
||||||
/**
|
|
||||||
* Return number of messages sent.
|
|
||||||
*/
|
|
||||||
uint64_t messageCounter() const
|
|
||||||
{
|
|
||||||
return _messageCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a transaction
|
* Start a transaction
|
||||||
*/
|
*/
|
||||||
|
|
@ -782,14 +768,6 @@ public:
|
||||||
*/
|
*/
|
||||||
DeferredPublisher *publisher() const { return _publisher.get(); }
|
DeferredPublisher *publisher() const { return _publisher.get(); }
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset message counter
|
|
||||||
*/
|
|
||||||
void resetMessageCounter()
|
|
||||||
{
|
|
||||||
_messageCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel class is its friend, thus can it instantiate this object
|
* The channel class is its friend, thus can it instantiate this object
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -515,9 +515,6 @@ DeferredPublisher &ChannelImpl::publish(const std::string &exchange, const std::
|
||||||
bytesleft -= chunksize;
|
bytesleft -= chunksize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment message counter
|
|
||||||
_messageCounter++;
|
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return *_publisher;
|
return *_publisher;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,6 @@ public:
|
||||||
// channel does not exist
|
// channel does not exist
|
||||||
if(!channel) return false;
|
if(!channel) return false;
|
||||||
|
|
||||||
// reset message counter
|
|
||||||
channel->resetMessageCounter();
|
|
||||||
|
|
||||||
// report that the channel is open
|
// report that the channel is open
|
||||||
if (channel->reportSuccess()) channel->onSynchronized();
|
if (channel->reportSuccess()) channel->onSynchronized();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue