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/pull_ack_handler.h>
Classes | |
class | Impl |
Allow applications to mock an PullAckHandler . More... | |
Public Member Functions | |
PullAckHandler (PullAckHandler &&)=default | |
PullAckHandler & | operator= (PullAckHandler &&)=default |
~PullAckHandler () | |
future< Status > | ack () && |
Acknowledges the message associated with this handler. More... | |
future< Status > | 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... | |
PullAckHandler (std::unique_ptr< Impl > impl) | |
Applications may use this constructor in their mocks. More... | |
Defines the interface to acknowledge and reject messages.
When applications pull a message from Cloud Pub/Sub messages the response includes both the pubsub::Message
and its associated pubsub::PullAckHandler
. Actions on a pubsub::PullAckHandler
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.
This class is thread compatible; only one thread should call non-const member functions of this class at a time. Note that because the non-const member functions are &&
overloads the application can only call ack()
or nack()
exactly once, and only one of them.
|
default |
google::cloud::pubsub::PullAckHandler::~PullAckHandler | ( | ) |
|
inlineexplicit |
Applications may use this constructor in their mocks.
Acknowledges the message associated with this handler.
If exactly-once is not enabled, the request is handled on a best-effort basis.
If the future is satisfied with an Okay Status
and exactly-once delivery is enabled in the subscription, then the message will not be resent by Cloud Pub/Sub. We remind the reader that Cloud Pub/Sub defaults to "at least once" delivery. That is, without exactly-once delivery, the message may be resent even after the future is satisfied with an Okay Status
.
If the future is satisfied with an error, it is possible that Cloud Pub/Sub never received the acknowledgement, and will resend the message.
|
inline |
Returns the approximate number of times that Cloud Pub/Sub has attempted to deliver the associated message to a subscriber.
Rejects the message associated with this handler.
If exactly-once is not enabled, the request is handled on a best-effort basis.
In any case, Cloud Pub/Sub will eventually resend the message. It might do so sooner if the operation succeeds.
|
default |