Content-Length: 276757 | pFad | http://github.com/googleapis/python-pubsub/commit/8dca3e8d20b8606235175a6519d143892745777a

24 Print actual number of messages pulled [(#2078)](https://github.com/G… · googleapis/python-pubsub@8dca3e8 · GitHub
Skip to content

Commit 8dca3e8

Browse files
olivercoadplamut
authored andcommitted
Print actual number of messages pulled [(#2078)](GoogleCloudPlatform/python-docs-samples#2078)
* Print actual number of messages pulled
1 parent f418bca commit 8dca3e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

samples/snippets/subscriber.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ def synchronous_pull(project_id, subscription_name):
284284
# Acknowledges the received messages so they will not be sent again.
285285
subscriber.acknowledge(subscription_path, ack_ids)
286286

287-
print("Received and acknowledged {} messages. Done.".format(NUM_MESSAGES))
287+
print('Received and acknowledged {} messages. Done.'.format(
288+
len(response.received_messages)))
288289
# [END pubsub_subscriber_sync_pull]
289290

290291

@@ -357,7 +358,8 @@ def worker(msg):
357358
if processes:
358359
time.sleep(SLEEP_TIME)
359360

360-
print("Received and acknowledged {} messages. Done.".format(NUM_MESSAGES))
361+
print('Received and acknowledged {} messages. Done.'.format(
362+
len(response.received_messages)))
361363
# [END pubsub_subscriber_sync_pull_with_lease]
362364

363365

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/python-pubsub/commit/8dca3e8d20b8606235175a6519d143892745777a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy