A helper class for proxy objects to remote APIs.
- For more information about rpc API version numbers, see:
- rpc/dispatcher.py
-
class RpcProxy(topic, default_version)
Bases: object
A helper class for rpc clients.
This class is a wrapper around the RPC client API. It allows you to
specify the topic and API version in a single place. This is intended to
be used as a base class for a class that implements the client side of an
rpc API.
-
call(context, msg, topic=None, version=None, timeout=None)
rpc.call() a remote method.
Parameters: |
- context – The request context
- msg – The message to send, including the method and args.
- topic – Override the topic for this message.
- timeout – (Optional) A timeout to use when waiting for the
response. If no timeout is specified, a default timeout will be
used that is usually sufficient.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | The return value from the remote method.
|
-
cast(context, msg, topic=None, version=None)
rpc.cast() a remote method.
Parameters: |
- context – The request context
- msg – The message to send, including the method and args.
- topic – Override the topic for this message.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | None. rpc.cast() does not wait on any return value from the
remote method.
|
-
cast_to_server(context, server_params, msg, topic=None, version=None)
rpc.cast_to_server() a remote method.
Parameters: |
- context – The request context
- server_params – Server parameters. See rpc.cast_to_server() for
details.
- msg – The message to send, including the method and args.
- topic – Override the topic for this message.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | None. rpc.cast_to_server() does not wait on any
return values.
|
-
fanout_cast(context, msg, version=None)
rpc.fanout_cast() a remote method.
Parameters: |
- context – The request context
- msg – The message to send, including the method and args.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | None. rpc.fanout_cast() does not wait on any return value
from the remote method.
|
-
fanout_cast_to_server(context, server_params, msg, version=None)
rpc.fanout_cast_to_server() a remote method.
Parameters: |
- context – The request context
- server_params – Server parameters. See rpc.cast_to_server() for
details.
- msg – The message to send, including the method and args.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | None. rpc.fanout_cast_to_server() does not wait on any
return values.
|
-
static make_msg(method, **kwargs)
-
multicall(context, msg, topic=None, version=None, timeout=None)
rpc.multicall() a remote method.
Parameters: |
- context – The request context
- msg – The message to send, including the method and args.
- topic – Override the topic for this message.
- timeout – (Optional) A timeout to use when waiting for the
response. If no timeout is specified, a default timeout will be
used that is usually sufficient.
- version – (Optional) Override the requested API version in this
message.
|
Returns: | An iterator that lets you process each of the returned values
from the remote method as they arrive.
|