airflow.providers.redis.sensors.redis_pub_sub

Module Contents

Classes

RedisPubSubSensor

Redis sensor for reading a message from pub sub channels.

class airflow.providers.redis.sensors.redis_pub_sub.RedisPubSubSensor(*, channels, redis_conn_id, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Redis sensor for reading a message from pub sub channels.

Parameters
  • channels (list[str] | str) – The channels to be subscribed to (templated)

  • redis_conn_id (str) – the redis connection id

template_fields: Sequence[str] = ('channels',)[source]
ui_color = '#f0eee4'[source]
pubsub()[source]
poke(context)[source]

Check for message on subscribed channels and write to xcom the message with key message.

An example of message {'type': 'message', 'pattern': None, 'channel': b'test', 'data': b'hello'}

Parameters

context (airflow.utils.context.Context) – the context object

Returns

True if message (with type ‘message’) is available or False if not

Return type

bool

Was this entry helpful?