The Server is used to build a RPC server which provides RPC Method to one or more clients. A sample of a simple RPC server is shown here:

import callme

def add(a, b):
    return a + b

server = callme.Server(server_id='fooserver',
server.register_function(add, 'add')
class callme.server.Server(server_id, amqp_host='localhost', amqp_user='guest', amqp_password='guest', amqp_vhost='/', amqp_port=5672, ssl=False, threaded=False, durable=False, auto_delete=True)

This Server class is used to provide an RPC server.

  • server_id – id of the 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
  • threaded – use of multithreading, if set to true RPC call-execution will processed parallel (one thread per call) which dramatically improves performance
  • durable – make all exchanges and queues durable
  • auto_delete – delete queues after all connections are closed

Return whether server is running.

register_function(func, name=None)

Registers a function as rpc function so that is accessible from the proxy.

  • func – the function we want to provide as rpc method
  • name – the name with which the function is visible to the clients

Start the server.


Stop the server.


Wait until server is started.

Previous topic

Callme - A python RPC module based on AMQP

Next topic


This Page