Skip to content

Commit

Permalink
WIP - Pass Quarkus Kafka dev services broker URL to Camel
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jun 13, 2022
1 parent e82c314 commit dfc2615
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extensions/kafka/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.apache.camel.quarkus.component.kafka.test;

import java.util.Collections;
import java.util.Optional;

import io.quarkus.test.common.ArtifactLauncher.InitContext.DevServicesLaunchResult;
import io.quarkus.test.common.DefaultNativeImageLauncher;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

public class CamelQuarkusNativeImageLauncher extends DefaultNativeImageLauncher {

@Override
public void init(NativeImageInitContext initContext) {
super.init(initContext);

Config config = ConfigProvider.getConfig();
DevServicesLaunchResult result = initContext.getDevServicesLaunchResult();

String kafkaBootstrapServers = result.properties().get("kafka.bootstrap.servers");
Optional<String> camelKafkaBrokers = config.getOptionalValue("camel.component.kafka.brokers", String.class);
if (kafkaBootstrapServers != null && camelKafkaBrokers.isEmpty()) {
includeAsSysProps(Collections.singletonMap("camel.component.kafka.brokers", kafkaBootstrapServers));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.apache.camel.quarkus.component.kafka.test.CamelQuarkusNativeImageLauncher

0 comments on commit dfc2615

Please sign in to comment.