Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
589 views
in Technique[技术] by (71.8m points)

apache kafka - Exception for non-existent topic in MassTransit

When topic in Kafka doesn't exist and there is an endpoint configuration done for it with TopicEndpoint method, it throws an exception: Confluent.Kafka.ConsumeException: Broker: Unknown topic or partition. After the topic is created, the exception doesn't occur anymore. How to set up the automatic topic creation for endpoints configured with TopicEndpoint method?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Automatic topic creation is not currently supported, and based on experience with a number of enterprises using Kafka, they don't recommend it either. Typically it is something that is managed so that proper partitioning and ownership can be applied to the topic (rather than just guessing).

In fact, I'm not sure it's even possible for a Kafka consumer (using the Confluent client) to automatically create the topic. There are aspects such as the schema registry, etc. that are taken into consideration as well.

I am open to the discussion, but the choices made were based upon interviewing teams using Kafka who said they wouldn't usually allow topics to be created automatically.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...