airflow.providers.ibm.mq.triggers.mq¶
Classes¶
Trigger that polls an IBM MQ queue and fires a TriggerEvent when a message arrives. |
Module Contents¶
- class airflow.providers.ibm.mq.triggers.mq.AwaitMessageTrigger(mq_conn_id, queue_name, poll_interval=5, open_options=None)[source]¶
Bases:
airflow.triggers.base.BaseEventTriggerTrigger that polls an IBM MQ queue and fires a TriggerEvent when a message arrives.
Delegates to
IBMMQHook.aconsume()which retries with exponential back-off on transient failures so that an AssetWatcher is never silently killed by a broken connection or swallowed exception.The trigger consumes messages with
MQGMO_NO_SYNCPOINT, so it provides at-most-once delivery semantics. If the trigger is canceled after IBM MQ returns a message but before Airflow yields the correspondingTriggerEvent, that message may be lost.- Parameters:
- 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.