airflow.providers.common.messaging.triggers.msg_queue

Classes

MessageQueueTrigger

MessageQueueTrigger serves as a unified trigger for monitoring message queues from different providers.

Module Contents

class airflow.providers.common.messaging.triggers.msg_queue.MessageQueueTrigger(*, queue, **kwargs)[source]

Bases: airflow.triggers.base.BaseEventTrigger

MessageQueueTrigger serves as a unified trigger for monitoring message queues from different providers.

It abstracts away provider-specific details, allowing users to monitor a queue with a single trigger, regardless of the underlying provider.

This makes it easy to switch providers without modifying the trigger.

Parameters:

queue (str) – The queue identifier

See also

For more information on how to use this trigger, take a look at the guide: Wait for a message in a queue

queue[source]
kwargs[source]
property trigger: airflow.triggers.base.BaseEventTrigger[source]
serialize()[source]

Return the information needed to reconstruct this Trigger.

Returns:

Tuple of (class path, keyword arguments needed to re-instantiate).

Return type:

tuple[str, dict[str, Any]]

async run()[source]

Run the trigger in an asynchronous context.

The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.

If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).

In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.

Was this entry helpful?