Is it possible to NACK messages?

2,790 views
Skip to first unread message

Ory Band

unread,
Jan 4, 2017, 11:29:07 AM1/4/17
to Google Cloud Pub/Sub Discussions
Let's say I have a Pub/Sub subscription with 10 min deadline.
If I pull 5 messages, and 3 of them failed, is there a way to return them back into the queue (NACKing these messages) instead of having to wait for their deadline timeout?

Max Dietz

unread,
Jan 4, 2017, 11:37:03 AM1/4/17
to Ory Band, Google Cloud Pub/Sub Discussions
Yes, you can call ModifyAckDeadline with a deadline of 0 seconds, and this will cause them to be NACKed.

Thanks,
Max

On Wed, Jan 4, 2017 at 11:29 AM Ory Band <ory...@gmail.com> wrote:
Let's say I have a Pub/Sub subscription with 10 min deadline.
If I pull 5 messages, and 3 of them failed, is there a way to return them back into the queue (NACKing these messages) instead of having to wait for their deadline timeout?

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-pubsub-discuss/f35ad940-368b-4472-ac63-dc051ef975ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kamal Aboul-Hosn

unread,
Jan 4, 2017, 11:47:17 AM1/4/17
to Ory Band, Google Cloud Pub/Sub Discussions
Hi, Ory,

As Max mentions, you would want to set the ack deadline to 0. This can be done in several ways. If you are using the client library, they tend to offer a way to nack directly. For example, the Java library provides the the nack method and the Go library allows you to call Done on a message with ack set to false. If you are using the RPC API or REST API directly, you should call ModifyAckDeadline with a deadline of 0 for the messages (RPC APIREST API).

Regards,

Kamal

On Wed, Jan 4, 2017 at 11:29 AM Ory Band <ory...@gmail.com> wrote:
Let's say I have a Pub/Sub subscription with 10 min deadline.
If I pull 5 messages, and 3 of them failed, is there a way to return them back into the queue (NACKing these messages) instead of having to wait for their deadline timeout?

--
Reply all
Reply to author
Forward
0 new messages