This document describes an older version of Celery (2.1).
For the latest stable version please
go here.
Events - celery.events
-
celery.events.Event(type, **fields)
Create an event.
An event is a dictionary, the only required field is the type.
-
class celery.events.EventDispatcher(connection, hostname=None, enabled=True)
Send events as messages.
Parameters: |
- connection – Carrot connection.
- 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.
|
You need to close() this after use.
-
close()
Close the event dispatcher.
-
disable()
-
enable()
-
flush()
-
send(type, **fields)
Send event.
Parameters: |
- type – Kind of event.
- **fields – Event arguments.
|
-
class celery.events.EventReceiver(connection, handlers=None, wakeup=True)
Capture events.
Parameters: |
- connection – Carrot connection.
- 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)
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.
-
consumer()
-
handlers = {}
-
process(type, event)
Process the received event by dispatching it to the appropriate
handler.
-
celery.events.create_event(type, fields)