Releases: ag2ai/faststream
0.6.5
What's Changed
- fix: FastAPI 0.128 compatibility
- fix(docs): dependencies installation by @theseriff in #2710
- Add tests for XREADGROUP vs XAUTOCLAIM selection based on min_idle_time by @vvlrff in #2713
- fix: polish middleware types in favor to Pycharm by @Lancetnik in #2715
- suppress
ServiceUnavailableErrorfor nats by @swelborn in #2720
New Contributors
Full Changelog: 0.6.4...0.6.5
v0.6.4
What's Changed
- feat: Enables message keys for batch publishing by @ozeranskii in #2586
- feat: add env variable to disable rich CLI output by @Lancetnik in #2654
- feat: Add api for nats message scheduling by @sheldygg in #2640
- feat: trace is printed only once by @fil1n in #2661
- fix: update fast depends config when setting a broker by @borisalekseev in #2701
- fix: Dont raise on unknown content types by @borisalekseev in #2702
- fix(redis): fix xautoclaim consumption by @JonathanSerafini in #2628
- fix: bug in AsyncAPI schema by @kittywaresz in #2638
- fix(rabbit): handle leading slash in virtualhost correctly by @Vitaly312 in #2707
- fix: use publisher's exchange when applicable to send reply by @lachaib in #2655
- fix: kafka ack policies` behaviour by @borisalekseev in #2644
- refactor: streamline conditional logic in
get_onemethod of stream … by @powersemmi in #2667 - refactor: restructure justfile and unify cross-platform commands by @suiseriff in #2690
- refactor(docs): actualize kafka how to by @WorkHardes in #2692
- docs: Added a Code examples article by @RenameMe1 in #2670
- docs: Fix kafka subscribe docs and llms.txt by @borisalekseev in #2700
- docs: Fix link reference in FastAPI integration docs by @supadrupa in #2681
- chore: LICENSE copying added by @ZoRex15 in #2685
- chore: Add warning when using AckPolicy.REJECT_ON_ERROR with kafka by @borisalekseev in #2686
- chore: skip relator notifications for dependabot events by @if-i in #2669
- chore: added no_confirm=True warning by @roma-frolov in #2703
- chore: update relator by @Sehat1137 in #2650
New Contributors
- @if-i made their first contribution in #2669
- @supadrupa made their first contribution in #2681
- @ZoRex15 made their first contribution in #2685
- @WorkHardes made their first contribution in #2692
- @Vitaly312 made their first contribution in #2707
- @lachaib made their first contribution in #2655
Full Changelog: 0.6.3...0.6.4
v0.6.3
What's Changed
- Fix annotation for group_instance_id parameter by @gandhis1 in #2606
- Add support for
min_idle_timein Redis StreamSub and XAUTOCLAIM by @powersemmi in #2607 - fix incorrect nats annotations by @swelborn in #2619
- docs(healthchecks): Fix typing example by @redb0 in #2624
- add nats kv message annotation by @swelborn in #2626
- redis: allow tasks to be added to subscribers by @JonathanSerafini in #2622
- Reusing router in multiple brokers or routers by @borisalekseev in #2591
- fix: remove UltraJSON (ujson) dependency by @Sehat1137 in #2634
- fix: allow explicit publishing to partition #0 of a topic from a Kafka publisher by @antoinehumbert in #2629
- docs: Versioning policy by @RenameMe1 in #2623
- docs: Update faststream.md by @RenameMe1 in #2631
- docs: Added reference to broker's RPC modes by @RenameMe1 in #2636
- docs: Add Guidilines: Links in documentation by @RenameMe1 in #2637
- fix enable.auto.commit kafka setting by @borisalekseev in #2612
- docs: fix checkboxes by @Lancetnik in #2643
- fix: FastAPI 0.121 compat by @Lancetnik in #2648
New Contributors
- @gandhis1 made their first contribution in #2606
- @swelborn made their first contribution in #2619
- @redb0 made their first contribution in #2624
Full Changelog: 0.6.2...0.6.3
v0.6.2
What's Changed
- Asgi request validation error and docs by @borisalekseev in #2525
- fix: docs render if broker is set by set_broker by @Sehat1137 in #2592
- feat: custom labels in prometheus metrics by @roma-frolov in #2555
- Add LICENSE file info in distribution by @Nifacy in #2595
- Mock
xackandxdelmethods in Redis testing setup. by @powersemmi in #2599 - fix: correct group_id default usage by @Lancetnik in #2601
- fix: force ERROR log level in CriticalLogMiddleware by @Lancetnik in #2602
- fix: AsyncAPI 3.0 server security use ref by @Lancetnik in #2603
- lint: fix confluent subscriber decorator annotation by @Lancetnik in #2604
New Contributors
Full Changelog: 0.6.1...0.6.2
v0.6.1
What's Changed
- feat: add --loop option to run command by @dimastbk in #2572
- chore(deps): typing extensions to >=4.12.0 by @maksimv0202 in #2575
- chore: update reagento/relator by @Sehat1137 in #2577
- feat(otel): Allows configurable message counters by @ozeranskii in #2579
- chore: Updates CODE_OF_CONDUCT link in README.md by @ozeranskii in #2583
- fix: expose ContextRepo to public API by @Lancetnik in #2581
- fix: pass serializer to message in RMQ TestClient by @Lancetnik in #2582
New Contributors
- @dimastbk made their first contribution in #2572
- @maksimv0202 made their first contribution in #2575
- @ozeranskii made their first contribution in #2579
Full Changelog: 0.6.0...0.6.1
v0.6.0
Description
FastStream 0.6 is a significant technical release that aimed to address many of the current project design issues and unlock further improvements on the path to version 1.0.0. We tried our best to minimize breaking changes, but unfortunately, some aspects were simply not working well. Therefore, we decided to break them in order to move forward.
This release includes:
- Finalized Middleware API
- Finalized Router API
- Introduced dynamic subscribers
- Added support for various serializer backends (such as Msgspec)
- Support for AsyncAPI 3.0 specification
- A range of minor refactors and improvements
The primary goal of this release is to unlock the path towards further features. Therefore, we are pleased to announce that after this release, we plan to work on MQTT #956 and SQS #794 support and move towards version 1.0.0!
Breaking changes
Firstly, we have dropped support for Python 3.8 and Python 3.9. Python 3.9 is almost at the end of its life cycle, so it's a good time to update our minimum version.
FastStream object changes
The broker has become a POSITIONAL-ONLY argument. This means that FastStream(broker=broker) is no longer valid. You should always pass the broker as a separate positional argument, like FastStream(brokers), to ensure proper usage.
This is a preparatory step for FastStream(*brokers) support, which will be introduced in 1.0.0.
AsyncAPI changes
In 0.6, you can't directly pass custom AsyncAPI options to the FastStream constructor anymore.
app = FastStream( # doesn't work anymore
...,
title="My App",
version="1.0.0",
description="Some description",
)You need to create a specification object and pass it manually to the constructor.
from faststream import FastStream, AsyncAPI
FastStream(
...
specification=AsyncAPI(
title="My App",
version="1.0.0",
description="Some description",
)
)Retry feature removed
Previously, you were able to configure retry attempts for a handler by using the following option:
@broker.subscriber("in", retry=True) # was removed
async def handler(): ...Unfortunately, this option was a design mistake. We apologize for any confusion it may have caused. Technically, it was just a shortcut to message.nack() on error. We have decided that manual acknowledgement control would be more idiomatic and better for the framework. Therefore, we have provided a new feature in its place: ack_policy control.
@broker.subscriber("test", ack_policy=AckPolicy.ACK_FIRST)
async def handler() -> None: ...With ack_policy, you can now control the default acknowledge behavior for your handlers. AckPolicy offers the following options:
- REJECT_ON_ERROR (default) – to permanently discard messages on failure.
- NACK_ON_ERROR – to redeliver messages in case of failure.
- ACK_FIRST – for scenarios with high throughput where some message loss can be acceptable.
- ACK – if you want the message to be acknowledged, regardless of success or failure.
- MANUAL – fully manually control message acknowledgment (for example, calling #!python message.ack() yourself).
In addition, we have deprecated a few more options prior to ack_policy.
ack_first=True->AckPolicy.ACK_FIRSTno_ack=True->AckPolicy.MANUAL
Context changes
We have made some changes to our Dependency Injection system, so the global context is no longer available.
Currently, you cannot simply import the context from anywhere and use it freely.
from faststeam import context # was removedInstead, you should create the context in a slightly different way. The FastStream object serves as an entry point for this, so you can place it wherever you need it:
from typing import Annotated
from faststream import Context, ContextRepo, FastStream
from faststream.rabbit import RabbitBroker
broker = RabbitBroker()
app = FastStream(
broker,
context=ContextRepo({
"global_dependency": "value",
}),
)Everything else about using the context remains the same. You can request it from the context at any place that supports it.
Additionally, Context("broker") and Context("logger") have been moved to the local context. They cannot be accessed from lifespan hooks any longer.
@app.after_startup
async def start(
broker: Broker # does not work anymore
): ...
@router.subscriber
async def handler(
broker: Broker # still working
): ...This change was also made to support multiple brokers.
Middlewares changes
Also, we have finalized our Middleware API. It now supports all the features we wanted, and we have no plans to change it anymore. First of all, the BaseMiddleware class constructor requires a context (which is no longer global).
class BaseMiddleware:
def __init__(self, msg: Any | None, context: ContextRepo) -> None:
self.msg = msg
self.context = contextThe context is now available as self.context in all middleware methods.
We also changed the publish_scope function signature.
class BaseMiddleware: # old signature
async def publish_scope(
self,
call_next: "AsyncFunc",
msg: Any,
*args: Any,
**kwargs: Any,
) -> Any: ...Previously, any options passed to brocker.publish("msg", "destination") had to be consumed as *args, **kwargs.
Now, you can consume them all as a single PublishCommand object.
from faststream import PublishCommand
class BaseMiddleware:
async def publish_scope(
self,
call_next: Callable[[PublishCommand], Awaitable[Any]],
cmd: PublishCommand,
) -> Any: ...Thanks to Python 3.13's TypeVars with defaults, BaseMiddleware becomes a generic class and you can specify the PublishCommand for the broker you want to work with.
from faststream.rabbit import RabbitPublishCommand
class Middleware(BaseMiddleware[RabbitPublishCommand]):
async def publish_scope(
self,
call_next: Callable[[RabbitPublishCommand], Awaitable[Any]],
cmd: RabbitPublishCommand,
) -> Any: ...Warning: The methods on_consume, after_consume, on_publish and after_publish will be deprecated and removed in version 0.7. Please use consume_scope and publish_scope instead.
Redis Default Message format changes
In FastStream 0.6 we are using BinaryMessageFormatV1 as a default instead of JSONMessageFormat .
You can find more details in the documentation: https://faststream.ag2.ai/latest/redis/message_format/
New Features:
-
AsyncAPI3.0 support – now you can choose between
AsyncAPI(schema_version="3.0.0")(default) andAsyncAPI(schema_version="2.6.0")schemas generation -
Msgspec native support
from fast_depends.msgspec import MsgSpecSerializer broker = Broker(serializer=MsgSpecSerializer())
-
Subscriber iteration support. This features supports all middlewares and other FastStream features.
subscriber = broker.subscriber(..., persistent=False) await subscriber.start() async for msg in subscriber: ...
Deprecation removed
@broker.subscriber(..., filters=...)removedmessage.decoded_bodyremoved, useawait message.decode()insteadpublish(..., rpc=True)removed, usebroker.request()instead- RabbitMQ
@broker.subscriber(..., reply_config=...)removed, useResponseinstead
What's Changed
- ConfuentConfig delivery.timeout.ms option added by @stepanbobrik in #2381
- chore: create notification for new issue by @Sehat1137 in #2384
- docs: Add Serialization details & Partial body consuming by @RenameMe1 in #2378
- 0.6.0 by @Lancetnik in #1779
- ci: correct just-install job by @Lancetnik in #2393
- ci: ignore secret detection false positive by @bsoyka in #2399
- fix(redis): assign serializer to internal producer in LogicPublisher by @loRes228 in #2396
- types: add Rabbit type tests by @RenameMe1 in #2401
- docs: updated manual run with broker examples by @ArtyomVysotskiy in #2402
- tests: remove useless tests by @Lancetnik in #2403
- fix: Added missing DecodedMessage export to faststream.types by @loRes228 in #2405
- types: add Nats type tests by @RenameMe1 in #2406
- types: add Confluent type tests by @RenameMe1 in #2407
- ci: add zizmor and implement related fixes by @bsoyka in #2398
- Docs: fix list of modes by @Totorokrut in #2413
- CI: use pre-commit-ci-lite instead of manual commit step during linters by @kittywaresz in #2416
- lint(rabbit): check publisher and subscriber by @ApostolFet in #2415
- dont replace hyphen in cli values by @borisa...
v0.6.0rc4
What's Changed
This is the latest RC version before the stable release. 0.6.0 is scheduled to be released on 10/10/2025.
- fix: #2462 list subscriber consume/stop race by @NelsonNotes in #2531
- fix: correct NATS dynamic subscriber stop by @Lancetnik in #2539
- docs: add warning about idle dynamic subscribers in test clients by @IvanKirpichnikov in #2540
- docs: fix readme badges by @draincoder in #2523
- docs: Added an example to manual reuse the message's "correlation_id" by @RenameMe1 in #2526
- docs: Added Args Doc to StreamSub by @RenameMe1 in #2534
- docs: two phrasing corrections by @axgkl in #2541
- chore: Remove Doc() part1 by @RenameMe1 in #2532
- chore: Remove Doc() part2 by @RenameMe1 in #2536
- refactor: impl ArgsDto to standardize CLI commands by @Lancetnik in #2544
- test: add extended test for 2513 bug by @Lancetnik in #2545
- ci: use uv ecosystem for dependanbot by @Lancetnik in #2535
New Contributors
Full Changelog: 0.6.0rc3...0.6.0rc4
v0.6.0rc3
What's Changed
- ci: create update release PRs to main: by @Lancetnik in #2490
- ci: use PAT to build docs by @Lancetnik in #2491
- ci: update telegram-notifier & send message to oss board by @Sehat1137 in #2492
- ci: explicit user set in docs build pipeline by @Lancetnik in #2494
- fix: incorrect asyncapi render by @Sehat1137 in #2495
- feat: task supervisor by @fil1n in #2408
- docs: Actualize structlog example by @borisalekseev in #2501
- docs: new Gurubase widget token by @Lancetnik in #2502
- chore: update lock by @Lancetnik in #2503
- Fix RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was… by @maxsonferovante in #2509
- feat: asgi request by @borisalekseev in #2467
- BugFix: add missing serializer in redis test request builder by @JonathanSerafini in #2517
- configure supervisor to use default logging behaviour by @JonathanSerafini in #2518
- feat: add
broker.subscriber(persistent=False)argument to control WeakRef behavior by @Lancetnik in #2519 - fix: #2513 add magic subscriber name for publisher without routing key by @Lancetnik in #2515
- Improve docs testing section (publisher and subscriber) by @lubaskinc0de in #2521
New Contributors
- @fil1n made their first contribution in #2408
- @maxsonferovante made their first contribution in #2509
- @lubaskinc0de made their first contribution in #2521
Full Changelog: 0.6.0rc2...0.6.0rc3
v0.6.0rc2
What's Changed
- fix(aiokafka): AttributeError on first _LoggingListener.on_partitions_assigned by @legau in #2453
- chore: change issue format by @Sehat1137 in #2465
- docs: Joined context pages into one page by @RenameMe1 in #2460
- fix: add benches.csv, some confluent fixes by @Flosckow in #2461
- docs: Improve cli overview by @borisalekseev in #2414
- Feat: switch image from bitnami to confluent by @Flosckow in #2482
- Feature/update docs by @Kolanar in #2457
- Add new issue workflow by @Sehat1137 in #2481
- fix: 0.6.0rc2 release changes by @Lancetnik in #2485
- 0.6.0rc2 release 08-29-2025 by @Lancetnik in #2454
- ci: change default branch to main back by @Lancetnik in #2488
Full Changelog: 0.6.0rc1...0.6.0rc2
v0.6.0rc1
What's Changed
- ci: correct just-install job by @Lancetnik in #2393
- ci: ignore secret detection false positive by @bsoyka in #2399
- fix(redis): assign serializer to internal producer in LogicPublisher by @loRes228 in #2396
- types: add Rabbit type tests by @RenameMe1 in #2401
- docs: updated manual run with broker examples by @ArtyomVysotskiy in #2402
- tests: remove useless tests by @Lancetnik in #2403
- fix: Added missing DecodedMessage export to faststream.types by @loRes228 in #2405
- types: add Nats type tests by @RenameMe1 in #2406
- types: add Confluent type tests by @RenameMe1 in #2407
- ci: add zizmor and implement related fixes by @bsoyka in #2398
- Docs: fix list of modes by @Totorokrut in #2413
- CI: use pre-commit-ci-lite instead of manual commit step during linters by @kittywaresz in #2416
- lint(rabbit): check publisher and subscriber by @ApostolFet in #2415
- dont replace hyphen in cli values by @borisalekseev in #2426
- docs: update contributing guide with pip upgrade and fix mkdocs serve… by @Kolanar in #2427
- cli: Fix assertion to app object is Application instance by @loRes228 in #2428
- Docs: add llms.txt by @vldmrdev in #2421
- Docs/middlewares main changes by @Maclovi in #2425
- lint: Kafka overrides polish by @Lancetnik in #2429
- Docs: Add example defining custom prometheus metrics to documentation by @Samoed in #2431
- fix: Redis pubsub connection leak in request method by @veronchenko in #2430
- Fix issue 2391 For rabbit and redis fastapi by @ApostolFet in #2437
- Docs: add example with annotated dependencies by @Samoed in #2438
- CI: make the linter great again by @kittywaresz in #2439
- Docs: change scripts folder to
justby @Samoed in #2436 - Closes #2391 add polish for kafka and nats fastapi by @Flosckow in #2442
- fix(asyncapi): promote nested pydantic to components/schemas by @legau in #2445
- fix: pass stream to concurrent subscribers by @Lancetnik in #2449
New Contributors
- @bsoyka made their first contribution in #2399
- @loRes228 made their first contribution in #2396
- @ArtyomVysotskiy made their first contribution in #2402
- @Totorokrut made their first contribution in #2413
- @kittywaresz made their first contribution in #2416
- @Kolanar made their first contribution in #2427
- @vldmrdev made their first contribution in #2421
- @Samoed made their first contribution in #2431
- @veronchenko made their first contribution in #2430
- @legau made their first contribution in #2445
Full Changelog: 0.6.0rc0...0.6.0rc1