Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pubsub streaming pull nack vs no acknowledge behaviour

nack() have following beaviour

nack() """Decline to acknowldge the given message. This will cause the message to be re-delivered to the subscription.

Now in streaming pull, I am pulling taxiride streaming data tested following behavior.

with nack() Streaming pull continues to receive messages which were previously nacked()

Neither nack() or ack() Streaming reads initial bunch of messages and waits for long time. I waited for almost 15 mins but it didn't pulled any new message.

Now my question is, in streaming pull when a message is neither ack() or nack(), what is the expected behavior and right way to process these messages? Lets say if I want to count backlog messages every minute as processing requirement?

like image 384
Neeraj Kumar Avatar asked Jul 16 '26 04:07

Neeraj Kumar


1 Answers

When a message is neither acked nor nacked, the Cloud Pub/Sub client library maintains the lease on the message for up to the maxAckExtensionPeriod. Once that time period has passed, the message will be nacked and redelivered. The reason you are not getting any more messages when you neither ack nor nack is likely because you are running into the values specified in the flowControlSettings, which limits the number of messages that can be outstanding and not yet acked or nacked.

It is generally an anti-pattern to neither ack nor nack messages. If you successfully process the message, you should ack it. If you are unable to process it (say some type of transient exception occurs) then you should nack it. Trying to receive messages without performing one of these actions isn't really going to be an effective way to count the number of messages in the backlog.

like image 102
Kamal Aboul-Hosn Avatar answered Jul 19 '26 07:07

Kamal Aboul-Hosn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!