Releases: airtai/faststream
v0.5.24
What's Changed
- Replace while-sleep with Event by @Olegt0rr in #1683
- feat: add explicit CLI import error by @Lancetnik in #1785
- fix (#1780): replace / in generated json refs by @Lancetnik in #1786
- Fix: this commit resolve #1765 by @Flosckow in #1789
- fix (#1792): make RMQ publisher.publish reply_to optional by @Lancetnik in #1795
- fix (#1793): FastStream Response support in FastAPI integration by @Lancetnik in #1796
- Update exception.md by @pepellsd in #1803
- Fixes the CI bug that allows PRs with failed tests to be merged. by @davorrunje in #1807
- feat: add CLI support for AsgiFastStream by @Sehat1137 in #1782
- docs: add contributors page by @kumaranvpl in #1808
- fix: correct dependency injection of custom context fields implementing partial eq/ne by @antoinehumbert in #1809
- do not assume discriminator is not a property by @lecko-cngroup in #1811
New Contributors
- @Olegt0rr made their first contribution in #1683
- @pepellsd made their first contribution in #1803
- @antoinehumbert made their first contribution in #1809
- @lecko-cngroup made their first contribution in #1811
Full Changelog: 0.5.23...0.5.24
v0.5.23
What's Changed
We made last release just a few days ago, but there are some big changes here already!
-
First of all - you can't use
faststream run ...
command withoutpip install faststream[cli]
distribution anymore. It was made to minify default (and production) distribution by removing typer (rich and click) dependencies. CLI is a development-time feature, so if you don't need - just don't install! Special thanks to @RubenRibGarcia for this change -
The next big change - Kafka publish confirmations by default! Previous FastStream version was working in publish & forgot style, but the new one blocks your
broker.publish(...)
call until Kafka confirmation frame received. To fallback to previous logic just use a new flagbroker.publish(..., no_confirm=True)
-
Also, we made one more step forward to our 1.0.0 features plan! @KrySeyt implements
get_one
feature. Now you can use any broker subscriber to get messages in imperative style:
subscriber = broker.subscriber("in")
...
msg = await subscriber.get_one(timeout=5.0)
- And the last one: @draincoder continues to develop OTEL support! Now he provides us with an ability to use OTEL spans and baggage in a comfortable FastStream-style. Just take a look at the new documentation section
Big thanks to all new and old contributors who makes such a great release!
- feat: AsgiFastStream hooks init options by @Lancetnik in #1768
- fix (#1748): add Kafka publish no_confirm option by @Lancetnik in #1749
- Fix GeneralExceptionHandler typehint by @sheldygg in #1773
- Add
broker.subscriber().get_one()
by @KrySeyt in #1726 - Add OTel baggage support by @draincoder in #1692
- build(#1430): separate cli faststream to its own distribution by @RubenRibGarcia in #1769
New Contributors
- @RubenRibGarcia made their first contribution in #1769
Full Changelog: 0.5.22...0.5.23
v0.5.22
What's Changed
- fix: FastAPI 0.112.4+ compatibility by @Lancetnik in #1766
Full Changelog: 0.5.21...0.5.22
v0.5.21
What's Changed
- feat (#1168): allow include regular router to FastAPI integration by @Lancetnik in #1747
- In case if core-subscriber receive a JetStream message. by @sheldygg in #1751
- feat: explicit final message commit status by @Lancetnik in #1754
- Fix/context get local default by @Lancetnik in #1752
- fix (#1759): correct ConfluentConfig with enums by @Lancetnik in #1762
- Adds SASLOAuthBearer flow to AIO Kafka's Faststream Security Parsing by @sifex in #1761
- fix: FastAPI 0.112.3 compatibility by @Lancetnik in #1763
Full Changelog: 0.5.20...0.5.21
v0.5.20
What's Changed
- Refactor: change publisher fake subscriber generation logic by @Lancetnik in #1729
- Remove docs/api directory before running create_api_docs script by @kumaranvpl in #1730
- CI: automatically approve & merge Dependabot PRs by @dolfinus in #1720
- Run check broken links after docs deploy by @kumaranvpl in #1733
- Feature: extend FastStream.init by @Sehat1137 in #1734
- Fix Dependabot group names by @dolfinus in #1737
- Fix: respect ignored exceptions by @Lancetnik in #1735
- Fix: update FastAPI to 0.112.2 by @Lancetnik in #1736
Full Changelog: 0.5.19...0.5.20
v0.5.19
What's Changed
The current release is planned as a latest feature release before 0.6.0. All other 0.5.19+ releases will contain only minor bugfixes and all the team work will be focused on next major one.
There a lot of changes we want to present you now though!
New RPC feature
Our old broker.publish(..., rpc=True)
implementation was very limited and ugly. Now we present you a much suitable way to do the same thing - broker.request(...)
from faststream import FastStream
from faststream.nats import NatsBroker, NatsResponse, NatsMessage
broker = NatsBroker()
@broker.subscriber("test")
async def echo_handler(msg):
return NatsResponse(msg, headers={"x-token": "some-token"})
@app.after_startup
async def test():
# The old implementation was returning just a message body,
# so you wasn't be able to check response headers, etc
msg_body: str = await broker.publish("ping", "test", rpc=True)
assert msg_body == "ping"
# Now request return the whole message and you can validate any part of it
# moreover it triggers all your middlewares
response: NatsMessage = await broker.request("ping", "test")
Exception Middleware
Community asked and community did! Sorry, we've been putting off this job for too long. Thanks for @Rusich90 to help us!
Now you can wrap your application by a suitable exception handlers. Just check the new documentation to learn more.
Details
Also, there are a lot of minor changes you can find below. Big thanks to all our old and new contributors! You are amazing ones!
- Bug: resolve missing seek on kafka fakeconsumer by @JonathanSerafini in #1682
- replace pip with uv in CI by @newonlynew in #1688
- Added support for JSON serialization and deserialization by other libraries by @ulbwa in #1687
- Fix batch nack by @kumaranvpl in #1689
- Remove unused ignores by @kumaranvpl in #1690
- docs: add Kafka HowTo section by @Lancetnik in #1686
- Add missed out group_instance_id as subscriber and router parameter by @kumaranvpl in #1695
- Set warn_unused_ignores mypy config to true by @kumaranvpl in #1694
- Skip building docs in pre-commit CI job by @kumaranvpl in #1704
- Fix to run check-docs-changes workflow in forks by @kumaranvpl in #1710
- feature/exception_middleware add exception middleware by @Rusich90 in #1604
- Remove mentions of faststream-gen by @kumaranvpl in #1717
- Fix multiple docs issues by @kumaranvpl in #1718
- CI: group Dependabot updates into one PR by @dolfinus in #1719
- feat: CLI DX improvements by @Lancetnik in #1723
- fix: use async test subscribers functions by @Lancetnik in #1725
- feat: add broker.request method by @Lancetnik in #1649
New Contributors
- @JonathanSerafini made their first contribution in #1682
- @Rusich90 made their first contribution in #1604
- @dolfinus made their first contribution in #1719
Full Changelog: 0.5.18...0.5.19
v0.5.18
What's Changed
- Added additional parameters to HandlerException by @ulbwa in #1659
- Removed Doc and Added docstrings instead by @Kirill-Stepankov in #1662
- feat (#1663): support default values for Header by @Lancetnik in #1667
- fix (#1660): correct patch nested JStream subjects by @Lancetnik in #1666
- fix: add ConfluentRouter FastAPI missed init options by @Lancetnik in #1664
- Add kerberos support for confluent broker by @kumaranvpl in #1670
- Fix nack for kafka and confluent brokers by @kumaranvpl in #1678
- fix: support all RMQ exchanges in AsyncAPI by @Lancetnik in #1679
- fix: catch parser errors by @Lancetnik in #1680
New Contributors
- @ulbwa made their first contribution in #1659
- @Kirill-Stepankov made their first contribution in #1662
Full Changelog: 0.5.17...0.5.18
v0.5.17
What's Changed
Just a hotfix for the following case:
@broker.subscriber(...)
async def handler():
return NatsResponse(...)
await broker.publish(..., rpc=True)
- chore(deps): bump semgrep from 1.83.0 to 1.84.0 by @dependabot in #1650
- chore(deps): bump mkdocs-material from 9.5.30 to 9.5.31 by @dependabot in #1651
- Update Release Notes for 0.5.16 by @faststream-release-notes-updater in #1652
- hotfix: correct NatsResponse processing in RPC case by @Lancetnik in #1654
Full Changelog: 0.5.16...0.5.17
v0.5.16
What's Changed
Well, seems like it is the biggest patch release ever 😃
Detail Responses
First of all, thanks to all new contributors, who helps us to improve the project! They made a huge impact to this release by adding new Kafka security mechanisms and extend Response API - now you can use broker.Response
to publish detail information from handler
@broker.subscriber("in")
@broker.publisher("out")
async def handler(msg):
return Response(msg, headers={"response_header": "Hi!"}) # or KafkaResponse, etc
ASGI
Also, we added a new huge feature - ASGI support!
Nope, we are not HTTP-framework now, but it is a little ASGI implementation to provide you with an ability to host documentation, use k8s http-probes and serve metrics in the same with you broker runtime without any dependencies.
You just need to use AsgiFastStream class
from faststream.nats import NatsBroker
from faststream.asgi import AsgiFastStream, make_ping_asgi
from prometheus_client import make_asgi_app
from prometheus_client.registry import CollectorRegistry
broker = NatsBroker()
prometheus_registry = CollectorRegistry()
app = AsgiFastStream(
broker,
asyncapi_path="/docs",
asgi_routes=[
("/health", make_ping_asgi(broker, timeout=5.0)),
("/metrics", make_asgi_app(registry=prometheus_registry))
]
)
And then you can run it like a regular ASGI app
uvicorn main:app
Confluent partitions
One more thing - manual topic partition assignment for Confluent. We have it already for aiokafka, but missed it here... Now it was fixed!
from faststream.confluent import TopicPartition
@broker.subscriber(partitions=[
TopicPartition("test-topic", partition=0),
])
async def handler():
...
Detail changes
- feat: add RMQ
fail_fast
option in #1647 - fix: correct nested
NatsRouter
subjects prefixes behavior - fix typos by @newonlynew in #1609
- Feat: extend response api by @Flosckow in #1607
- Feature: GSSAPI (Kerberos) support by @roma-frolov in #1633
- feat: add oauth support by @filip-danieluk in #1632
- fix: patch broker within testbroker context only by @sfran96 in #1619
- feat: ASGI support by @Lancetnik in #1635
New Contributors
- @newonlynew made their first contribution in #1609
- @roma-frolov made their first contribution in #1633
- @filip-danieluk made their first contribution in #1632
- @sfran96 made their first contribution in #1619
Full Changelog: 0.5.15...0.5.16
v0.5.15
What's Changed
Finally, FastStream has a Kafka pattern subscription! This is another step forward in our Roadmap moving us to 0.6.0 and futher!
from faststream import Path
from faststream.kafka import KafkaBroker
broker = KafkaBroker()
@broker.subscriber(pattern="logs.{level}")
async def base_handler(
body: str,
level: str = Path(),
):
...
Also, all brokers now supports a new ping
method to check real broker connection
is_connected: bool = await broker.ping()
This is a little, but important change for K8S probes support
More other there are a lot of bugfixes and improvements from our contributors! Thanks to all of these amazing people!
- feat(multiprocess): restart child processes if they are not alive by @gostilovichd in #1550
- fix: use typing_extensions.TypedDict import by @Lancetnik in #1575
- fix: correct single dataclass argument AsyncAPI payload generation by @Lancetnik in #1591
- fix (#1598): use config with NATS PullSub by @Lancetnik in #1599
- feat: default call_name for broker.subscriber by @KrySeyt in #1589
- Feat: init ping method by @Flosckow in #1592
- chore: bump nats-py requirement by @Lancetnik in #1600
- fix: add pattern checking by @spataphore1337 in #1590
New Contributors
- @gostilovichd made their first contribution in #1550
- @KrySeyt made their first contribution in #1589
- @Flosckow made their first contribution in #1592
Full Changelog: 0.5.14...0.5.15