def get_hook(self) -> SqsHook: """Create and return an SqsHook""" if self.hook: return self.hook self.hook = SqsHook(aws_conn_id=self.aws_conn_id) return self.hook
def execute(self, context: 'Context'): """ Publish the message to SQS queue :param context: the context object :return: dict with information about the message sent For details of the returned dict see :py:meth:`botocore.client.SQS.send_message` :rtype: dict """ hook = SqsHook(aws_conn_id=self.aws_conn_id) result = hook.send_message( queue_url=self.sqs_queue, message_body=self.message_content, delay_seconds=self.delay_seconds, message_attributes=self.message_attributes, ) self.log.info('result is send_message is %s', result) return result
def delete_queue_fn(queue_url): """This is a Python function that deletes an SQS queue""" hook = SqsHook() hook.get_conn().delete_queue(QueueUrl=queue_url)
def create_queue_fn(): """This is a Python function that creates an SQS queue""" hook = SqsHook() result = hook.create_queue(queue_name=QUEUE_NAME) return result['QueueUrl']
def delete_queue_fn(queue_url): """Delete the example queue""" hook = SqsHook() hook.get_conn().delete_queue(QueueUrl=queue_url)
def create_queue_fn(): """Create the example queue""" hook = SqsHook() result = hook.create_queue(queue_name=QUEUE_NAME) return result['QueueUrl']