Skip to main content

faststream-sqs-sns

CI Coverage PyPI Downloads Supported Python versions License

An Amazon SQS broker for FastStream, with SNS fan-out publishing, maintained by the community.

Subscribers long-poll a queue and keep each message invisible until the handler settles it. Publishers send to a queue or to an SNS topic, one message or a batch. Two clients sit behind one shared core: CapoSqsBroker (capo) and AiobotocoreSqsBroker (aiobotocore). Handlers, routers, tests and exceptions are the same for both.

Install

Pick the client the broker talks to AWS with:

pip install "faststream-sqs-sns[capo]"
pip install "faststream-sqs-sns[aiobotocore]"

The package needs Python 3.10 or newer and FastStream 0.7. Other extras: otel (OpenTelemetry), prometheus and cli (the faststream command). SSO profiles with capo need capo-sqs[sso] and capo-sns[sso] next to the capo extra.

With capo

from faststream import FastStream
from pydantic import BaseModel

from faststream_sqs_sns import CapoSqsBroker, SnsTopic, SqsQueue


class Order(BaseModel):
    id: int
    amount: float


broker = CapoSqsBroker(region="eu-central-1")
app = FastStream(broker)

orders = SnsTopic("orders", declare=True)
shipments = broker.publisher("shipments")


@broker.subscriber(SqsQueue("orders-billing", declare=True), topic=orders)
@shipments
async def bill(order: Order) -> dict[str, int]:
    # the return value is sent to the `shipments` queue
    return {"order_id": order.id}


@app.after_startup
async def place_order() -> None:
    await broker.publish(Order(id=1, amount=9.5), orders)
faststream run service:app

The handler reads the orders-billing queue, which the broker subscribes to the orders topic, decodes the JSON body into Order, deletes the message once the handler returns, and sends its result to the shipments queue.

With aiobotocore

import logging

from faststream import FastStream

from faststream_sqs_sns import AiobotocoreSqsBroker, SqsQueue

# the same handlers run on either backend: only the class of the broker changes
broker = AiobotocoreSqsBroker(region="eu-central-1")
app = FastStream(broker)
logger = logging.getLogger(__name__)


@broker.subscriber(SqsQueue("orders", declare=True))
async def bill(order: dict[str, int]) -> None:
    logger.info("billing order %s", order["id"])

Testing

TestSqsBroker runs the service in process, with the limits of the real service:

async with TestSqsBroker(broker) as br:
    await br.publish(Order(id=1, amount=9.5), "orders")

    bill.mock.assert_called_once_with({"id": 1, "amount": 9.5})

Documentation

Development

See CONTRIBUTING.md. The source lives at https://github.com/powersemmi/faststream-sqs-sns.

License

Apache License 2.0.

Metadata

Release files for faststream-sqs-sns 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faststream-sqs-sns 0.1.0
File Size Uploaded Provenance Actions
faststream_sqs_sns-0.1.0.tar.gz 63.8 kB With provenance Details for faststream_sqs_sns-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for faststream-sqs-sns 0.1.0
File Interpreter ABI Platform Actions
faststream_sqs_sns-0.1.0-py3-none-any.whl Python 3 none any Details for faststream_sqs_sns-0.1.0-py3-none-any.whl

Total release size: 145.7 kB

Release files / faststream_sqs_sns-0.1.0.tar.gz

Download URL faststream_sqs_sns-0.1.0.tar.gz
Size 63.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8fad6ebc68639c30715d202625d330729e515b37a4b7fc8de2e86adc0e85c7a
BLAKE2b-256 checksum
How to use checksums
2ce634d2d4a9af7034123b1a8f111ac5efc1dcf5b989bdd69348ac69285b59b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / faststream_sqs_sns-0.1.0-py3-none-any.whl

Download URL faststream_sqs_sns-0.1.0-py3-none-any.whl
Size 81.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6572b19a445bd5fed63165bbb075a54c7c32b25c7b99c17777639fa1617d7cb
BLAKE2b-256 checksum
How to use checksums
9c2a1368aa10356441d99986dfc0f665eabfd20b467ba5ce84db55538f92063a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for faststream-sqs-sns 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for faststream_sqs_sns-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page