Filter Kafka Batch #2423
Answered
by
Lancetnik
dom-gunstone
asked this question in
Q&A
Filter Kafka Batch
#2423
-
Hi, Is it possible to filter a (Confluent) Kafka batch like this? from faststream.confluent import KafkaBroker
broker = KafkaBroker(...)
subscriber = broker.subscriber(..., batch=True)
@broker.subscriber(filter=lambda msg: msg.headers["user"] == "foo")
async def foo(body: list[dict]) -> None:
# Only messages with headers["user"] == "foo"
...
@broker.subscriber(filter=lambda msg: msg.headers["user"] == "bar")
async def foo(body: list[dict]) -> None:
# Only messages with headers["user"] == "bar"
... |
Beta Was this translation helpful? Give feedback.
Answered by
Lancetnik
Aug 7, 2025
Replies: 1 comment 1 reply
-
@dom-gunstone unfortunately, you can't filter out batch between various handlers. But it looks like a good feature |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dom-gunstone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dom-gunstone unfortunately, you can't filter out batch between various handlers. But it looks like a good feature