Skip to content

Releases: airtai/faststream

v0.5.23

09 Sep 19:44
521eaf2
Compare
Choose a tag to compare

What's Changed

We made last release just a few days ago, but there are some big changes here already!

  1. First of all - you can't use faststream run ... command without pip 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

  2. 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 flag broker.publish(..., no_confirm=True)

  3. 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)
  1. 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!

New Contributors

Full Changelog: 0.5.22...0.5.23

v0.5.22

05 Sep 18:28
c273500
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.5.21...0.5.22

v0.5.21

05 Sep 13:36
fc26675
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.5.20...0.5.21

v0.5.20

30 Aug 09:51
89bfbac
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.5.19...0.5.20

v0.5.19

24 Aug 20:17
8ec5a42
Compare
Choose a tag to compare

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!

New Contributors

Full Changelog: 0.5.18...0.5.19

v0.5.18

13 Aug 13:14
4bf70ad
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.5.17...0.5.18

v0.5.17

08 Aug 16:29
f9324a3
Compare
Choose a tag to compare

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

07 Aug 20:53
0112632
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: 0.5.15...0.5.16

v0.5.15

18 Jul 19:44
15cbe6b
Compare
Choose a tag to compare

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!

New Contributors

Full Changelog: 0.5.14...0.5.15

v0.5.14

26 Jun 06:43
4a2341d
Compare
Choose a tag to compare

What's Changed

  • Update Release Notes for 0.5.13 by @faststream-release-notes-updater in #1548
  • Add allow_auto_create_topics to make automatic topic creation configurable by @kumaranvpl in #1556

Full Changelog: 0.5.13...0.5.14