Pub/Sub access to message ack id in the subscribe use case
See original GitHub issueWhen pulling messages, we get ReceivedMessage
that contains the ack id that can then be used to ack multiple messages at once using the ModifyAckDeadlineRequest
.
However, on the subscribe side all we get is PubsubMessage
and AckReplyConsumer
, without access to the ack id of the message. So, this means that we cannot ack messages in batch.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Pull subscriptions | Cloud Pub/Sub Documentation
In pull delivery, your subscriber application initiates requests to the Pub/Sub server to retrieve messages. You can use the pull mode to perform...
Read more >Subscribe to Messages from a Topic - Go CDK
The Go CDK can receive messages from a Google Cloud Pub/Sub subscription. The URLs use the project ID and the subscription ID. pubsub....
Read more >Things I wish I knew about Google Cloud Pub/Sub: Part 2
First, a publisher sends a message to the topic. Once the Pub/Sub server receives the message, it adds fields to the message such...
Read more >Subscribers · DEoGC - rindra
Call the acknowledge method to indicate that the subscriber has finished processing the message and that the Pub/Sub server can delete it from...
Read more >Package pubsub - ActiveGo 1.8.3 Documentation
Ack has been called. Client code must be robust to multiple deliveries of messages. Deadlines ¶. The default pubsub deadlines are suitable for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@unoexperto Relatively speaking, I expect the AckReplyConsumer is going to be much smaller than the messages you are buffering themselves, so I don’t think holding on to them is going to be a major contributing factor to OOMs. However, holding on to messages for an hour in a subscriber client and only acking after a batch is flushed is an anti-pattern for Cloud Pub/Sub. You want to try to ack messages very quickly. The longer you wait to ack, the more risk there is of duplicate delivery, which would also waste resources. You’d be better off writing messages to some persistent storage locally when you receive them, acking them, and then flushing the data every hour. You could do this using Apache Beam/Cloud Dataflow.
@pongad @kamalaboulhosn This is very limiting factor. Could you please suggest how one can postpone acking bunch of messages? I’m using PubSub as durable storage of messages which I batch into 1 hr chunks and send elsewhere. I don’t want to accept messages until I’m sure my consumer got the batch. I could of course hold on to instances of
AckReplyConsumer
for each message in the batch that I haven’t processed yet but it poses risk of OOM exception as you point out in documentation.What would you suggest?