Proxy
The Proxy manages the client part of the RPC system:
Usage example:
import callme
proxy = callme.Proxy(amqp_host='localhost')
print(proxy.use_server('fooserver').add(1, 1))
-
class callme.proxy.Proxy(server_id, amqp_host='localhost', amqp_user='guest', amqp_password='guest', amqp_vhost='/', amqp_port=5672, ssl=False, timeout=60, durable=False, auto_delete=True)
This Proxy class is used to handle the communication with the rpc
server.
Parameters: |
- server_id – default id of the Server (can be declared later
see use_server())
- amqp_host – the host of where the AMQP Broker is running
- amqp_user – the username for the AMQP Broker
- amqp_password – the password for the AMQP Broker
- amqp_vhost – the virtual host of the AMQP Broker
- amqp_port – the port of the AMQP Broker
- ssl – use SSL connection for the AMQP Broker
- timeout – default timeout for calls in seconds
- durable – make all exchanges and queues durable
- auto_delete – delete server queues after all connections are closed
not applicable for client queues
|
-
use_server(server_id=None, timeout=None)
Use the specified server and set an optional timeout for the method
call.
Typical use:
>> my_proxy.use_server(‘fooserver’).a_remote_func()
Parameters: |
- server_id – the server id where the call will be made
- timeout – set or overrides the call timeout in seconds
|
Return type: | return self to cascade further calls
|