-
I have a topic/channel for a resource that contains multiple message types and schemas. (i.e. I want to make sure the message ordering is handled correctly (no @subscriber(
filter=lambda msg: msg.type == "book.created",
)
async def handle_cerated(msg: BookCreated):
...
@subscriber(
filter=lambda msg: msg.type == "book.borrowed",
)
async def handle_cerated(msg: BookBorrowed):
... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Filter logic just allows you to call different handler functions for one message consumption |
Beta Was this translation helpful? Give feedback.
Filter logic just allows you to call different handler functions for one message consumption
It is litterally the single subscriber, that iterates over your handlers and tries to find the first suitable one: https://github.com/airtai/faststream/blob/main/faststream/broker/subscriber/usecase.py#L335