jamesnetherton commented on a change in pull request #3161:
URL: https://github.com/apache/camel-quarkus/pull/3161#discussion_r723169008
##########
File path:
extensions/kafka/runtime/src/main/java/org/apache/camel/quarkus/component/kafka/KafkaClientFactoryProducer.java
##########
@@ -33,13 +35,30 @@
@Identifier("default-kafka-broker")
Map<String, Object> kafkaConfig;
+ @Inject
+ CamelKafkaRuntimeConfig camelKafkaRuntimeConfig;
+
+ @Inject
+ Config config;
+
@Produces
@Singleton
@DefaultBean
- public KafkaClientFactory kafkaClientFactory(CamelKafkaRuntimeConfig
config) {
- if (kafkaConfig != null && !kafkaConfig.isEmpty() &&
config.kubernetesServiceBinding.mergeConfiguration) {
+ public KafkaClientFactory kafkaClientFactory() {
+ if (isQuarkusKafkaClientFactoryRequired()) {
return new QuarkusKafkaClientFactory(kafkaConfig);
}
return null;
}
+
+ private boolean isQuarkusKafkaClientFactoryRequired() {
+ Optional<Boolean> serviceBindingEnabled = config.getOptionalValue(
+ "quarkus.kubernetes-service-binding.enabled",
+ Boolean.class);
Review comment:
The way defaults behave is that they are always resolvable when
referencing the property by name. So `isPresent()` will be true, even if no
explict config value has been specified.
Arguably `getOptionalValue` is not needed in this case. I used it out of
paranoia in case the property became unresolvable for some reason.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]