airflow.contrib.sensors.aws_sqs_sensor

Module Contents

class airflow.contrib.sensors.aws_sqs_sensor.SQSSensor(sqs_queue, aws_conn_id='aws_default', max_messages=5, wait_time_seconds=1, *args, **kwargs)[source]

Bases: airflow.sensors.base_sensor_operator.BaseSensorOperator

Get messages from an SQS queue and then deletes the message from the SQS queue. If deletion of messages fails an AirflowException is thrown otherwise, the message is pushed through XCom with the key message.

Parameters
  • aws_conn_id (str) – AWS connection id

  • sqs_queue (str) – The SQS queue url (templated)

  • max_messages (int) – The maximum number of messages to retrieve for each poke (templated)

  • wait_time_seconds (int) – The time in seconds to wait for receiving messages (default: 1 second)

template_fields = ['sqs_queue', 'max_messages'][source]
poke(self, context)[source]

Check for message on subscribed queue and write to xcom the message with key messages

Parameters

context (dict) – the context object

Returns

True if message is available or False