-
Notifications
You must be signed in to change notification settings - Fork 45
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
KafkaServerStartable removed in Kafka 2.8 #52
Comments
I tried to fix this but for some reason certain tests kept failing. My idea was to use reflection to switch to another class for 2.8.0: - private KafkaServerStartable broker;
+ private KafkaServer broker;
// ...
- broker = new KafkaServerStartable(brokerConfig);
+ try {
+ // use KafkaServerStartable for kafka_2.12 <2.8.0
+ Class<?> cl = Class.forName("kafka.server.KafkaServerStartable");
+ Constructor<?> constructor = cl.getConstructor(KafkaConfig.class);
+ broker = (KafkaServer) constructor.newInstance(brokerConfig);
+ } catch (ClassNotFoundException e) {
+ // use KafkaServer for kafka_2.12 >=2.8.0
+ Class<?> cl = Class.forName("kafka.server.KafkaServer");
+ Constructor<?> constructor = cl.getConstructor(KafkaConfig.class, Time.class, Option.class, boolean.class);
+ broker = (KafkaServer) constructor.newInstance(brokerConfig, Time.SYSTEM, Option.<String>empty(), false);
+ } We could also use Not sure if this is a good approach. Someone else will probably have a better idea on how to fix this. Especially regarding future-proofness, we probably don't want to run into chained try-catch statements for each future kafka version... |
I also ran into this. Trying to use To be fair, the README for this project says it supports through 2.6.x. But is there any intent to go beyond 2.6.x? |
See also discussion in issue #49 , it seems at least not an intention to stay at 2.6.x. |
For those looking for a solution now, I was able to switch to |
Sorry for the delay, I've spent some time today making some organizational changes to the library (switch from travisCI to Github actions) and officially added support for Kafka 2.7.x. I'll try to dig into how best to support 2.8.x and above, hopefully in a way that maintains backwards compatibility. |
I released v3.2.3 to maven central. It should support 2.8.x and be fully compatible with previous versions. Let me know if you run into any troubles. I ended up going more or less with your approach @dhenneke as it seemed like the easiest path forward. If this needs to be modified again the future we could optimize it by looking at the packaged Thanks! |
@Crim Great, thank you! I updated it in our library and our tests are green. |
awesome! Going to close out this issue. Thanks! |
I stumbled upon this when testing a quarkus based project using Kafka 2.8.
apache/kafka#9883
The text was updated successfully, but these errors were encountered: