Google Cloud Pub/Sub C++ Client 2.13.0
A C++ Client Library for Google Cloud Pub/Sub
|
Defines the interface to acknowledge and reject messages. More...
#include <google/cloud/pubsub/ack_handler.h>
Classes | |
class | Impl |
Allow applications to mock an AckHandler . More... | |
Public Member Functions | |
~AckHandler () | |
AckHandler (AckHandler &&)=default | |
AckHandler & | operator= (AckHandler &&)=default |
void | ack () && |
Acknowledges the message associated with this handler. More... | |
void | nack () && |
Rejects the message associated with this handler. More... | |
std::int32_t | delivery_attempt () const |
Returns the approximate number of times that Cloud Pub/Sub has attempted to deliver the associated message to a subscriber. More... | |
AckHandler (std::unique_ptr< Impl > impl) | |
Applications may use this constructor in their mocks. More... | |
Defines the interface to acknowledge and reject messages.
When applications register a callback to receive Pub/Sub messages the callback must be able to receive both a pubsub::Message
and its associated pubsub::AckHandler
. Actions on a pubsub::AckHandler
always affect the same message received in the callback. Applications cannot create standalone handlers (except in unit tests via mocks).
This interface allows applications to acknowledge and reject messages that are provided by the Cloud Pub/Sub C++ client library to the application. Note that this class is move-able, to support applications that process messages asynchronously. However, this class is not copy-able, because messages can only be acknowledged or rejected exactly once.
google::cloud::pubsub::AckHandler::~AckHandler | ( | ) |
|
default |
|
inlineexplicit |
Applications may use this constructor in their mocks.
|
inline |
Acknowledges the message associated with this handler.
ack()
. Applications developers are reminded that Cloud Pub/Sub offers "at least once" semantics so they should be prepared to handle duplicate messages.
|
inline |
Returns the approximate number of times that Cloud Pub/Sub has attempted to deliver the associated message to a subscriber.
|
inline |
Rejects the message associated with this handler.
nack()
. Applications developers are reminded that Cloud Pub/Sub offers "at least once" semantics so they should be prepared to handle duplicate messages.
|
default |