Skip to content

Commit

Permalink
polishing (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
davorrunje authored Apr 23, 2024
1 parent 1c39c7a commit 08e91d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"filename": "docs/docs/en/release.md",
"hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450",
"is_verified": false,
"line_number": 836,
"line_number": 1079,
"is_secret": false
}
],
Expand Down Expand Up @@ -163,5 +163,5 @@
}
]
},
"generated_at": "2024-04-07T03:11:32Z"
"generated_at": "2024-04-23T11:41:19Z"
}
26 changes: 13 additions & 13 deletions docs/docs/en/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ We already have some fixes related to `RedisBroker` (#1375, #1376) and some new
include_in_schema=False,
)
```

2. `KafkaBroker().subscriber(...)` now consumes `aiokafka.ConsumerRebalanceListener` object.
You can find more information about it in the official [**aiokafka** doc](https://aiokafka.readthedocs.io/en/stable/consumer.html?highlight=subscribe#topic-subscription-by-pattern)

(close #1319)

```python
broker = KafkaBroker()

broker.subscriber(..., listener=MyRebalancer())
```

Expand Down Expand Up @@ -101,37 +101,37 @@ subscriber = broker.subscriber("test")
@subscriber(filter = lambda msg: msg.content_type == "application/json")
async def handler(msg: dict[str, Any]):
...

@subscriber()
async def handler(msg: dict[str, Any]):
...
```

This is the preferred syntax for [filtering](https://faststream.airt.ai/latest/getting-started/subscription/filtering/) now (the old one will be removed in `0.6.0`)

3. The `router.publisher()` function now returns the correct `Publisher` object you can use later (after broker startup).

```python
publisher = router.publisher("test")

@router.subscriber("in")
async def handler():
await publisher.publish("msg")
```

(Until `0.5.0` you could use it in this way with `broker.publisher` only)

4. A list of `middlewares` can be passed to a `broker.publisher` as well:

```python
broker = Broker(..., middlewares=())

@broker.subscriber(..., middlewares=())
@broker.publisher(..., middlewares=()) # new feature
async def handler():
...
```

5. Broker-level middlewares now affect all ways to publish a message, so you can encode application outgoing messages here.

6. ⚠️ BREAKING CHANGE ⚠️ : both `subscriber` and `publisher` middlewares should be async context manager type
Expand Down Expand Up @@ -195,7 +195,7 @@ await subscriber.close()
* close #568
* close #1303
* close #1287
* feat #607
* feat #607
* Generate docs and linter fixes by @davorrunje in https://github.com/airtai/faststream/pull/1348
* Fix types by @davorrunje in https://github.com/airtai/faststream/pull/1349
* chore: update dependencies by @Lancetnik in https://github.com/airtai/faststream/pull/1358
Expand Down

0 comments on commit 08e91d2

Please sign in to comment.