Can I ack/nack message after the streaming pull timeout exceeds?

41 views Asked by At

I am writing a python program using Google CLoud Pub/Sub subscription, following this guide. Now I have the following code.

subscriber = pubsub_v1.SubscriberClient(my_credentials)
subscription_path = subscriber.subscription_path(my_project_id, my_subscription_id)
streaming_pull_future = subscriber.subscribe(my_subscription_path, my_callback)
with subscriber:
  try:
    streaming_pull_future.result(timeout=100)
  except futures.TimeoutError:
    # Can I ack or nack message here?
    streaming_pull_future.cancel()
    streaming_pull_future.result()

So my question is, could I ack or nack message after streaming_pull_future.result raises a futures.TimeoutError exception?

0

There are 0 answers