pikachewie.publisher – PikaChewie base publisher class

class pikachewie.publisher.BlockingPublisher(broker)

Base class for synchronous RabbitMQ publishers.

channel

Return an open channel to the RabbitMQ broker.

If necessary, create and cache a new channel.

class pikachewie.publisher.JSONPublisherMixin

Publisher Mixin that JSON-serializes the message payload.

publish(exchange, routing_key, payload, properties=None)

Publish a message to RabbitMQ on the same channel the original message was received on, automatically serializing the message payload.

Parameters:
  • exchange (str) – the exchange to publish to
  • routing_key (str) – the routing key to publish with
  • pikachewie.data.Properties – the message properties
  • dict|list – the message body to publish
class pikachewie.publisher.PublisherMixin

Mixin for publishing messages to RabbitMQ.

publish(exchange, routing_key, body, properties=None)

Publish a message to RabbitMQ.

properties should be an instance of pikachewie.data.Properties or None.

Parameters:
  • exchange (str) – the exchange to publish to
  • routing_key (str) – the routing key to publish with
  • body (str|unicode) – the message body to publish
  • properties (pikachewie.data.Properties) – the message properties