Rpc

The Rpc class for Rpc requests.

class amqppy.publisher.Rpc(broker)[source]

The duty of Rpc class is to make RPC requests and returns its responses. RPC pattern tutorial. The class instance will create on single connection to the broker for all the RPC requests.

Parameters:broker (str) – The URL for connection to RabbitMQ. Eg: ‘amqp://serviceuser:password@rabbit.host:5672//’
request(exchange, routing_key, body, timeout=10.0)[source]

Makes a RPC request and returns its response. RPC pattern tutorial. This call creates and destroys a connection every time, if you want to save connections, please use the class Rpc.

Parameters:
  • rounting_key (str) – The routing key to bind on
  • body (str) – The body of the message request you want to request. It should be of type unicode or string encoded with UTF-8.
  • exchange (str) – The exchange you want to publish the message.
  • timeout (bool) – Maximum seconds to wait for the response.