Search in sources :

Example 1 with KafkaBuildTimeConfig

use of io.quarkus.kafka.client.deployment.KafkaBuildTimeConfig in project camel-quarkus by apache.

the class KafkaProcessor method configureKafkaComponentForDevServices.

@BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
public void configureKafkaComponentForDevServices(DevServicesLauncherConfigResultBuildItem devServiceResult, 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)) {
        String kafkaBootstrapServers = devServiceResult.getConfig().get(KAFKA_BOOTSTRAP_SERVERS);
        if (kafkaBootstrapServers != null) {
            runTimeConfig.produce(new RunTimeConfigurationDefaultBuildItem(CAMEL_KAFKA_BROKERS, kafkaBootstrapServers));
        }
    }
}
Also used : GlobalDevServicesConfig(io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig) KafkaBuildTimeConfig(io.quarkus.kafka.client.deployment.KafkaBuildTimeConfig) Config(org.eclipse.microprofile.config.Config) RunTimeConfigurationDefaultBuildItem(io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)1 RunTimeConfigurationDefaultBuildItem (io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem)1 GlobalDevServicesConfig (io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig)1 KafkaBuildTimeConfig (io.quarkus.kafka.client.deployment.KafkaBuildTimeConfig)1 Config (org.eclipse.microprofile.config.Config)1