airflow.providers.common.messaging.providers.base_provider

Classes

BaseMessageQueueProvider

Base class defining a provider supported by operators/triggers of common-messaging provider.

Module Contents

class airflow.providers.common.messaging.providers.base_provider.BaseMessageQueueProvider[source]

Bases: abc.ABC

Base class defining a provider supported by operators/triggers of common-messaging provider.

To add a new provider supported by the provider, create a new class extending this base class and add it to MESSAGE_QUEUE_PROVIDERS.

Providers can support two dispatch paths: scheme-based matching (set scheme) and queue-URI-based matching (override queue_matches, and trigger_kwargs when the trigger needs parameters derived from the queue URI). trigger_class is required in both cases.

scheme: str | None = None[source]
scheme_matches(scheme)[source]

Return whether a given scheme (string) matches a specific provider’s pattern.

This function must be as specific as possible to avoid collision with other providers. Functions in this provider should NOT overlap with each other in their matching criteria.

Parameters:

scheme (str) – The scheme identifier

queue_matches(queue)[source]

Return whether a given queue (string) matches a specific provider’s pattern.

Providers that only support scheme-based dispatch keep this default, which matches nothing. Override it to support queue-URI-based dispatch; the implementation must be as specific as possible to avoid collision with other providers. Functions in this provider should NOT overlap with each other in their matching criteria.

Parameters:

queue (str) – The queue identifier

abstract trigger_class()[source]

Trigger class to use when queue_matches returns True.

trigger_kwargs(queue, **kwargs)[source]

Parameters passed to the instance of trigger_class on queue-URI-based dispatch.

Providers that only support scheme-based dispatch keep this default. Override it together with queue_matches when the trigger needs parameters derived from the queue URI.

Parameters:

queue (str) – The queue identifier

Was this entry helpful?