Skip to main content

No project description provided

Project description

Async SQS consumer

This is a simple asynchronous worker for consuming messages from AWS SQS.

This is a hobby project, if you find the project interesting any contribution is welcome

Usage

You must create an instance of the worker with the url of the queue.

Aws credentials are taken from environment variables, you must set the following environment variables

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
from async_sqs_consumer.worker import (
    Worker,
)

worker = Worker(
    queue_url="https://sqs.us-east-1.amazonaws.com/xxxxxxx/queue_name"
)


@worker.task("report")
async def report(text: str) -> None:
    print(text)

worker.start()

To publish the messages they must have the following structure

{
    "task": {"type": "string"},
    "id": {"type": "string"},
    "args": {"type": "array"},
    "kwargs": {"type": "object"},
    "retries": {"type": "number"},
    "eta": {"type": "string"},
    "expires": {"type": "string"},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_sqs_consumer-0.1.2.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

async_sqs_consumer-0.1.2-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page