Last active
September 14, 2020 09:51
-
-
Save babo/eca8a02a26f696a6d9960045c7691f13 to your computer and use it in GitHub Desktop.
Delete a specific message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from google.cloud import pubsub | |
| # Instantiates a client | |
| pubsub_client = pubsub.Client() | |
| sbscr = pubsub_client.subscription('demoapi_subscription_createTenant') | |
| i = 0 | |
| while True: | |
| for x in sbscr.pull(return_immediately=True): | |
| data = json.loads(x[1].data) | |
| if data: | |
| if data['processId'] == '081f211b-f77d-4a80-8f77-a650c85763a5': | |
| sbscr.acknowledge([x[0]]) | |
| i += 1 | |
| if i % 100 == 0: | |
| print(i) | |
| else: | |
| print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment