StreamingPullFuture(manager)
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.
Inheritance
builtins.object > google.api_core.future.base.Future > google.cloud.pubsub_v1.futures.Future > StreamingPullFutureMethods
add_done_callback
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.
Name | Description |
callback |
Callable
The function to call. |
cancel
cancel()
Stops pulling messages and shutdowns the background thread consuming messages.
cancelled
cancelled()
:returns: True
if the subscription has been cancelled.
:rtype: bool
done
done()
Return True the future is done, False otherwise.
This still returns True in failure cases; checking result
or
exception
is the canonical way to assess success or failure.
exception
exception(timeout=None)
Return the exception raised by the call, if any.
Name | Description |
timeout |
Union[int, float]
The number of seconds before this call times out and raises TimeoutError. |
Type | Description |
concurrent.futures.TimeoutError | If the request times out. |
Type | Description |
Exception | The exception raised by the call, if any. |
result
result(timeout=None)
Resolve the future and return a value where appropriate.
Name | Description |
timeout |
Union[int, float]
The number of seconds before this call times out and raises TimeoutError. |
Type | Description |
concurrent.futures.TimeoutError | If the request times out. |
Exception | For undefined exceptions in the underlying call execution. |
running
running()
Actions in Pub/Sub generally may not be canceled.
Type | Description |
bool | ``True`` if this method has not yet completed, or ``False`` if it has completed. |
set_exception
set_exception(exception)
Set the result of the future to the given exception.
Name | Description |
exception |
`Exception`
The exception raised. |
set_result
set_result(result)
Set the result of the future to the provided result.
Name | Description |
result |
Any
The result |