A schema-first FastStream framework with automatic retries and dead-letter handling.
Project description
easy-faststream
easy-faststream is a schema-first wrapper around FastStream for RabbitMQ.
Application developers define a Pydantic schema and a consumer function; the
framework handles validation, retry, acknowledgements, and dead-letter routing.
Example
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel
from easy_faststream import MessageContext, StreamApp
class TripRequested(BaseModel):
order_id: UUID
passenger_id: UUID | None = None
service_type: str
event_at: datetime
app = StreamApp.from_env()
@app.consumer(
event="passapp.trip.requested",
schema=TripRequested,
queue="p_q.passapp.trip.requested",
exchange="ex.passapp.event.trip",
)
async def consume_trip(
event: TripRequested,
context: MessageContext,
) -> None:
print(event.order_id, context.message_id)
Run the application through FastStream:
faststream run app:app.app
Environment variables
EASY_STREAM_RABBITMQ_URL=amqp://guest:guest@localhost:5672/
EASY_STREAM_APP_NAME=trip-consumer
EASY_STREAM_DEFAULT_EXCHANGE=easy.events
EASY_STREAM_DLQ_EXCHANGE=easy.events.dead
EASY_STREAM_MAX_RETRIES=3
EASY_STREAM_RETRY_DELAY_SECONDS=1
EASY_STREAM_RETRY_BACKOFF=2
Failure behavior
- Invalid schema: publish the original payload and validation details to the DLQ.
- Processing error: retry according to the configured policy, then publish to DLQ.
NonRetryableError: skip retries and publish directly to DLQ.- DLQ publish error: NACK and requeue the original RabbitMQ message.
- Success or successful DLQ publish: ACK the original message.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easy_faststream-0.2.0.tar.gz.
File metadata
- Download URL: easy_faststream-0.2.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be33ad6b2374206e15aaa57af0e770aa35f52cbad85a8f9fc2cfbb8a7f6fb985
|
|
| MD5 |
c3cf983138f0c4498ee8f85713dba36c
|
|
| BLAKE2b-256 |
9aab45a05bbda1e06e92920eec01b1035bbeb4cb6ad1a0e63480fa01804ad2d4
|
File details
Details for the file easy_faststream-0.2.0-py3-none-any.whl.
File metadata
- Download URL: easy_faststream-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab3323b1f60409b3597a42cef2991cf7035f903ee4170f9aae2ca6bcedbf0e8c
|
|
| MD5 |
b4565fbfc3408cabe853270cfee189d3
|
|
| BLAKE2b-256 |
3276cac25dfaf188049cc80bbc06e6c6042186dec1543ce2da6f44ffa01789ea
|