Closed zhfeng closed 2 years ago
/cc @cescoffier, @ozangunalp
Can't the KafkaProcessor handles null? Most dev services are doing this.
Can't you just get this info from 'io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem' ? It contains all the resulting dev service properties.
Thanks @stuartwdouglas and we use the following codes to consumer DevServicesKafkaBrokerBuildItem
@BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
public void configureKafkaComponentForDevServices(
DevServicesKafkaBrokerBuildItem kafkaBrokerBuildItem,
KafkaBuildTimeConfig kafkaBuildTimeConfig,
BuildProducer<RunTimeConfigurationDefaultBuildItem> runTimeConfig) {
Config config = ConfigProvider.getConfig();
Optional<String> brokers = config.getOptionalValue(CAMEL_KAFKA_BROKERS, String.class);
if (brokers.isEmpty() && kafkaBuildTimeConfig.devservices.enabled.orElse(true)) {
runTimeConfig.produce(new RunTimeConfigurationDefaultBuildItem(CAMEL_KAFKA_BROKERS,
kafkaBrokerBuildItem.getBootstrapServers()));
}
}
I'll try to use io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem
to see if it works.
yeah, it should work and I wil fix it in camel-quarkus-kafka
. Thanks all for helping !
Describe the bug
This issue comes across https://github.com/apache/camel-quarkus/issues/3284 It throws the NPE when runing with
mvn quarkus:dev
I think it might be an issue in Quarkus DevServicesKafkaProcessor. https://github.com/quarkusio/quarkus/blob/362199e0638e86ab57aa7e0c1fadfa16f4766bd8/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java#L89-L96
It returns
null
when there is no changes with configuration which means no needs to restart the kafka container. That cause camel-quarkus-kafkaKafkaProcessor
to throw NPE.Expected behavior
It needs to return the current broker url with
DevServicesKafkaBrokerBuildItem
.Actual behavior
It returns
null
.How to Reproduce?
please check https://github.com/tarilabs/quarkus-content-based-routing
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response