-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: OffsetCommit failed for mixed subscribtion on Kafka topic #1571
Comments
Your example is inherently flawed because you are specifying two different topics for the same consumer group. Use a single topic for one consumer group. |
Seems like you are using Kafka in a wrong way and this problem does not related to FastStream iself. Please, reopen the Issue if you don't agree |
Is there a problem to use one consumer group ID for several Kafka topics? I didn't find any restrictions in the Kafka architecture or its documentation. If you have any other information, please let me know. |
This looks like an issue with @dem214 The example you have mentioned works with import asyncio
import logging
from faststream import FastStream
# import from faststream.confluent instead of faststream.kafka
from faststream.confluent import KafkaRouter, TopicPartition, KafkaBroker
router = KafkaRouter()
@router.subscriber(
't1',
group_id='cg1',
)
async def handle_group(msg):
print('handle_group')
@router.subscriber(
group_id='cg1',
partitions=[TopicPartition('t2', 0), TopicPartition('t2', 1)]
)
async def handle_partition(msg):
print('handle_partition')
broker = KafkaBroker(
log_level=logging.INFO,
graceful_timeout=5.0,
)
broker.include_router(router, prefix='rtr_')
app = FastStream(broker)
# Added to publish a message to topics rtr_t1 and rtr_t2
@app.after_startup
async def publish_msgs() -> None:
async def _publish_msgs() -> None:
await asyncio.sleep(5)
print("Publishing messages")
await broker.publish({"name": "Alice"}, topic="rtr_t1")
await broker.publish({"name": "Bob"}, topic="rtr_t2")
asyncio.create_task(_publish_msgs()) If you need the behaviour you have mentioned, you could use |
Describe the bug
When subscribing to a topic through a coordinator and to partitions directly using one
group_id
, an error occurs, making consuming of messages is imposible.How to reproduce
Include source code:
And/Or steps to reproduce the behavior:
Expected behavior
Works fine and consume messages from both topics
Observed behavior
Got an error in logs:
Environment
Running FastStream 0.5.14 with CPython 3.11.4 on Linux
The text was updated successfully, but these errors were encountered: