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_async_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.1.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.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple_async_sqs-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4cd7394dfef7721e34b2c2df2c7157ad2799146fecd8fa2f4d6328d35bc8a9ec
MD5 0a2175d545c4bdd71829b0774214e01d
BLAKE2b-256 472706a56767ba2d46a08b4e1284e03cf2a094f3f10d52b14c932affad123963

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_async_sqs-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_async_sqs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba8e4f3fd24e6c5e1668c5f039681f13dbd6e4b709dfaf7d885baa40684432e7
MD5 c5341eb1a76d6c9f05d1d3420e131bc5
BLAKE2b-256 55681a97ff39d97c30fb5377899bb4b6abacc413d2eeac9a5c911937d36ec54e

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_async_sqs-0.1.1-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