Skip to main content

Simple async SQS client

Project description

simple-async-sqs

simple-async-sqs is a opinionated minimalistic async Python client to interact with SQS.

simple-async-sqs is for developers who are tired of repeated configurations in task frameworks and prefer a simple message processing library.

Installation

uv add simple-async-sqs

Optionally add the type stubs for used in development:

uv add --dev simple-async-sqs[stubs]

Usage

A consumer can be simply created by Client.consume which is simply an AsyncIterator.

Messages must be either ack'd or nack'd after processing.

import asyncio

from simple_sqs.queue_client import QueueClient


async def process(client: QueueClient):
    async for message in client.consume():
        try:
            print(message.get("Body"))
            ...
        except Exception:
            await client.nack(message, retry_timeout=20)
        else:
            await client.ack(message)


async def process_single():
    async with QueueClient.create("my-queue") as client:
        await process(client)

We can also easily parallelise the work here using asyncio.TaskGroup:

async def process_parallel(workers: int):
    async with QueueClient.create("my-queue") as client:
        async with asyncio.TaskGroup() as tg:
            for _ in range(workers):
                tg.create_task(process(client))

Producer

We can simply produce a message by:

await client.producer("my_message_payload", delay=10)

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

simple_async_sqs-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_async_sqs-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file simple_async_sqs-0.1.0.tar.gz.

File metadata

  • Download URL: simple_async_sqs-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for simple_async_sqs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 86a3c4cb99420ea9e60cdaecbdc2e2ce16e4b7bd2f536e27380a1a7e833b6a6f
MD5 6594ca625ee7dd60036a8c94a1109ead
BLAKE2b-256 2ca655d8c6511f37c1913c976376f14d53cd81a09c7fbdfe89a3b680bf629d27

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_async_sqs-0.1.0.tar.gz:

Publisher: python-publish.yml on Jamie-Chang/simple-async-sqs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_async_sqs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_async_sqs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eaefe700ea26ba4813cccf20b5fd59e56d8039b59c4e7acccc4ddbb7f968de70
MD5 a8a0dd2df4790d1ffcda83aaf2ac9140
BLAKE2b-256 01c474a150304b7199ddabb9fdb2e05d5fe5e06936b306d4fca4472070c19ec9

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_async_sqs-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on Jamie-Chang/simple-async-sqs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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