This document describes an older version of Celery (2.2). For the latest stable version please go here., **fields)

Create an event.

An event is a dictionary, the only required field is the type.

class, hostname=None, enabled=True, channel=None, buffer_while_offline=True, app=None, serializer=None)

Send events as messages.

  • connection – Connection to the broker.
  • hostname – Hostname to identify ourselves as, by default uses the hostname returned by socket.gethostname().
  • enabled – Set to False to not actually publish any events, making send() a noop operation.
  • channel – Can be used instead of connection to specify an exact channel to use when sending events.
  • buffer_while_offline – If enabled events will be buffered while the connection is down. flush() must be called as soon as the connection is re-established.

You need to close() this after use.


Close the event dispatcher.

send(type, **fields)

Send event.

  • type – Kind of event.
  • **fields – Event arguments.
class, handlers=None, routing_key='#', node_id=None, app=None)

Capture events.

  • connection – Connection to the broker.
  • handlers – Event handlers.

handlers is a dict of event types and their handlers, the special handler “*” captures all events that doesn’t have a handler.

capture(limit=None, timeout=None, wakeup=True)

Open up a consumer capturing events.

This has to run in the main process, and it will never stop unless forced via KeyboardInterrupt or SystemExit.


Create event consumer.


This creates a new channel that needs to be closed by calling

drain_events(limit=None, timeout=None)
handlers = {}
itercapture(limit=None, timeout=None, wakeup=True)
process(type, event)

Process the received event by dispatching it to the appropriate handler.

Dispatcher(connection=None, hostname=None, enabled=True, channel=None, buffer_while_offline=True)
Receiver(connection, handlers=None, routing_key='#', node_id=None)
State(), fields)

Previous topic


Next topic

This Page