Skip to main content

Events

Service used for sending monitoring events.

Attributes​

AttributeTypeDescription
requirestuple = (Connection,)Tuple of bootstep classes that must be initialized before the Events service can start.
groupslist = NoneList of event group names to be dispatched, such as 'worker' or 'task', used to filter which events are sent.
send_eventsbooleanBoolean flag indicating if the service is configured to transmit any event types based on task, gossip, or heartbeat settings.
enabledbooleanToggle that determines if the event dispatcher should actively process and send events.

Constructor​

Signature​

def Events(
c: Any,
task_events: boolean = True,
without_heartbeat: boolean = False,
without_gossip: boolean = False,
**kwargs: dict
) - > null

Parameters​

NameTypeDescription
cAnyThe consumer or parent object context.
task_eventsboolean = TrueFlag to enable task-related events.
without_heartbeatboolean = FalseFlag to disable heartbeat events.
without_gossipboolean = FalseFlag to disable gossip events.
**kwargsdictAdditional keyword arguments passed to the parent class constructor.

Methods​


start()​

@classmethod
def start(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null

Initializes and starts the event dispatcher to begin sending monitoring events. This method flushes any events buffered while the connection was down and configures the dispatcher with the current worker hostname and event groups.

Parameters​

NameTypeDescription
c[Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)The consumer instance providing the application context and connection for the event dispatcher.

Returns​

TypeDescription
null

stop()​

@classmethod
def stop(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null

Stops the event service; currently implemented as a no-op as teardown is handled during shutdown.

Parameters​

NameTypeDescription
c[Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)The consumer instance associated with this step.

Returns​

TypeDescription
null

shutdown()​

@classmethod
def shutdown(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null

Performs a clean shutdown of the event service by closing the dispatcher and releasing network resources.

Parameters​

NameTypeDescription
c[Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)The consumer instance whose event resources should be released.

Returns​

TypeDescription
null