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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy