celery.events
class celery.events.Events(app=None)
celery.events.Event(type, _fields=None, __dict__=<type ‘dict’>, __now__=<built-in function time>, \*fields*)[源代码]
Create an event.
An event is a dictionary, the only required field is type. A timestamp field will be set to the current time if not provided.
class celery.events.EventDispatcher(connection=None, hostname=None, enabled=True, channel=None, buffer_while_offline=True, app=None, serializer=None, groups=None)
Dispatches event messages.
You need to close() this after use.
DISABLED_TRANSPORTS = set([‘sql’])
app = None
close()
disable()[源代码]
extend_buffer(other)
Copies the outbound buffer of another instance.
flush()
Flushes the outbound buffer.
on_disabled = None
on_enabled = None
publish(type, fields, producer, retry=False, retry_policy=None, blind=False, utcoffset=<function utcoffset at 0xb126374>, Event=<function Event at 0xc2348b4>)[源代码]
Publish event using a custom instance.
publisher None
send(type, blind=False, \*fields*)[源代码]
Send event.
warn_if_yajl()
Capture events.
handlers is a dict of event types and their handlers, the special handler “*” captures all events that doesn’t have a handler.
app = None
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 .
connection None
event_from_message(body, localize=True, now=<built-in function time>, tzfields=<operator.itemgetter object at 0xb9a19cc>, adjust_timestamp=<function adjust_timestamp at 0xb1263ac>, CLIENT_CLOCK_SKEW=-1)
get_consumers(Consumer, channel)
itercapture(limit=None, timeout=None, wakeup=True)[源代码]
on_consume_ready(connection, channel, consumers, wakeup=True, \*kwargs*)
process(type, event)
Process the received event by dispatching it to the appropriate handler.