Example #1
0
def push(event, context):
    # Create an SNS client
    sns = boto3.client('sns')
    env = Variables()
    sqs = SqsHandler(env.get_sqs_dlq_url())

    while (True):
        response = sqs.getMessage(5)
        print(response)

        if ('Messages' not in response):
            break

        if (len(response['Messages']) == 0):
            break

        for msg in response['Messages']:

            # Publish a simple message to the specified SNS topic
            retorno = sns.publish(
                TopicArn=env.get_sns_arn(),
                Message=str(msg['Body']),
            )
            # Print out the response
            print(retorno)

            print('Deletando mensagem')
            sqs.deleteMessage(msg["ReceiptHandle"])
Example #2
0
def handler(event, context):

    env = Variables()
    sns = SnsHandler(env.get_sns_arn())

    sns.publish(event)

    print(event)