This document describes an older version of Celery (2.2).
For the latest stable version please
go here.
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=None, hostname=None, enabled=True, channel=None, buffer_while_offline=True, app=None, serializer=None)
Send events as messages.
Parameters: |
- 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()
Close the event dispatcher.
-
copy_buffer(other)
-
disable()
-
enable()
-
flush()
-
send(type, **fields)
Send event.
Parameters: |
- type – Kind of event.
- **fields – Event arguments.
|
-
class celery.events.EventReceiver(connection, handlers=None, routing_key='#', node_id=None, app=None)
Capture events.
Parameters: |
- 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.
-
consumer()
Create event consumer.
Warning
This creates a new channel that needs to be closed
by calling consumer.channel.close().
-
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.
-
wakeup_workers(channel=None)
-
class celery.events.Events(app=None)
-
Dispatcher(connection=None, hostname=None, enabled=True, channel=None, buffer_while_offline=True)
-
Receiver(connection, handlers=None, routing_key='#', node_id=None)
-
State()
-
celery.events.create_event(type, fields)