-
Notifications
You must be signed in to change notification settings - Fork 234
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
IncompatibleBrokerVersion: Kafka broker does not support the 'CreateTopicsRequest_v0' Kafka protocol. #1008
Comments
async with AIOKafkaAdminClient(...) as client:
... |
I have the same issue as OP. If I use the suggested context manager I get
so I wrap it into a from contextlib import asynccontextmanager
from aiokafka.admin import AIOKafkaAdminClient, NewTopic
@asynccontextmanager
async def get_admin_client():
admin_client = AIOKafkaAdminClient(
bootstrap_servers=settings.KAFKA_BOOTSTRAP_SERVERS
)
try:
yield admin_client
finally:
await admin_client.close()
async def create_topic():
async with get_admin_client() as admin_client:
try:
await admin_client.create_topics(
[
NewTopic(
name='mytopic',
num_partitions=1,
replication_factor=1,
)
]
)
except Exception as e:
print("oh no") Still get the error as OP:
How can we create topics with Version 0.11.0 |
@davidhuser I had the same problem as you, but I realized I never called the @asynccontextmanager
async def get_admin_client():
admin_client = AIOKafkaAdminClient(
bootstrap_servers=settings.KAFKA_BOOTSTRAP_SERVERS
)
try:
await admin_client.start()
yield admin_client
finally:
await admin_client.close() |
works now, thanks @trentbitterman ! |
Describe the bug
When trying to create a topic using AIOKafkaAdminClient, the following error is encountered:
Expected behaviour
The topic should be created successfully without throwing an IncompatibleBrokerVersion error.
Environment (please complete the following information):
0.10.0
and I am using apache/kafka:3.7.0 docker hub image to run kafka brokerkafka-topics.sh --version
):3.7.0
apache/kafka:3.7.0
Here's the compose.yaml file:
https://github.com/mjunaidca/kafka-playground/blob/main/python-kafka/compose.yml
Reproducible example
Additional context
The auto-creation of topics by producers/consumers works as expected. However, explicit creation using the admin client fails due to the broker version compatibility issue. This was tested with the Kafka broker version specified in the environment section.
The text was updated successfully, but these errors were encountered: