Callback mechanism for listening to Pub/Sub messages
See original GitHub issueI’d love for there to be a mechanism to set up perpetual pulling and acknowledging of Cloud Pub/Sub messages, the sort of thing that might enable code like this:
# Messages are acknowledged unless DoWork raises an exception
def DoWork(message):
    print "Message payload: %s" % message.payload
worker_thread = subscription.pull(callback=DoWork)
Issue Analytics
- State:
 - Created 7 years ago
 - Comments:7 (4 by maintainers)
 
Top Results From Across the Web
Pull subscriptions | Cloud Pub/Sub Documentation
In a pull subscription, a subscriber client requests messages from the Pub/Sub server. The pull mode can use one of the two service...
Read more >Google Cloud PubSub messages not processed by callback
However, some of the messages sent seem to be randomly dropped, and are not processed by the subscriber's callback method.
Read more >How to use Google Pub/Sub to build an asynchronous ...
A callback function is added to the subscriber. The callback function will be called automatically when some message is published to the topic...
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 >Pub/Sub | API | AmplifyJS - A Component Library for jQuery
callback : Function to invoke when the message is published. [ priority ]: Priority relative to other subscriptions for the same message. Lower...
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

FWIW, PR’s #1636 and #1637 offer competing strategies for doing “auto-acknowlegement” of message IDs.
And FTR we merged the implementation in #1636, making your example above look like: