Skip to content

v0.5.19

Compare
Choose a tag to compare
@Lancetnik Lancetnik released this 24 Aug 20:17
· 100 commits to main since this release
8ec5a42

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