Add onAck and onNack methods

This commit is contained in:
Marcin Gibula 2018-05-14 21:40:30 +02:00
parent 1a955b39af
commit ddee073278
1 changed files with 26 additions and 1 deletions

View File

@ -42,7 +42,6 @@ private:
*/
void process(BasicAckFrame &frame);
/**
* Process an ACK frame
*
@ -85,6 +84,32 @@ public:
// allow chaining
return *this;
}
/**
* Callback that is called when the broker confirmed message publication
* @param callback the callback to execute
*/
DeferredConfirm &onAck(const AckCallback &callback)
{
// store callback
_ackCallback = callback;
// allow chaining
return *this;
}
/**
* Callback that is called when the broker denied message publication
* @param callback the callback to execute
*/
DeferredConfirm &onNack(const NackCallback &callback)
{
// store callback
_nackCallback = callback;
// allow chaining
return *this;
}
};
/**