Futures#
-
class
google.cloud.pubsub_v1.subscriber.futures.
StreamingPullFuture
(manager)[source]# Represents a process that asynchronously performs streaming pull and schedules messages to be processed.
This future is resolved when the process is stopped (via
cancel()
) or if it encounters an unrecoverable error. Calling .result() will cause the calling thread to block indefinitely.-
add_done_callback
(callback)# Attach the provided callable to the future.
The provided function is called, with this future as its only argument, when the future finishes running.
- Parameters
callback (Callable) – The function to call.
- Returns
None
-
done
()# Return True the future is done, False otherwise.
This still returns True in failure cases; checking
result()
orexception()
is the canonical way to assess success or failure.
-
exception
(timeout=None)# Return the exception raised by the call, if any.
- Parameters
timeout (Union[int, float]) – The number of seconds before this call times out and raises TimeoutError.
- Raises
concurrent.futures.TimeoutError – If the request times out.
- Returns
The exception raised by the call, if any.
- Return type
-
result
(timeout=None)# Resolve the future and return a value where appropriate.
- Parameters
timeout (Union[int, float]) – The number of seconds before this call times out and raises TimeoutError.
- Raises
concurrent.futures.TimeoutError – If the request times out.
Exception – For undefined exceptions in the underlying call execution.
-
running
()# Actions in Pub/Sub generally may not be canceled.
- Returns
True
if this method has not yet completed, orFalse
if it has completed.
- Return type
-