This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit b83af3cfe9e73ee1c724c57c1d74dc997a0bb3b8 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Fri Jul 3 18:16:45 2020 +0200 Upgrade to Camel 3.4 #361 --- .../k/loader/groovy/GroovySourceLoader.groovy | 3 +- .../apache/camel/k/loader/groovy/LoaderTest.groovy | 4 +-- .../k/loader/groovy/dsl/IntegrationTest.groovy | 6 ++-- camel-k-main/camel-k-runtime-health/pom.xml | 4 +++ .../camel/k/health/HealthContextCustomizer.java | 2 +- .../camel-k-quarkus-core/deployment/pom.xml | 12 ------- .../quarkus/deployment/DeploymentProcessor.java | 31 ++-------------- .../camel/k/core/quarkus/RuntimeRecorder.java | 8 ----- .../camel-k-quarkus-cron/deployment/pom.xml | 12 ------- .../camel-k-quarkus-knative/deployment/pom.xml | 12 ------- .../deployment/pom.xml | 12 ------- .../camel-k-quarkus-loader-java/deployment/pom.xml | 12 ------- .../camel-k-quarkus-loader-js/deployment/pom.xml | 12 ------- .../deployment/pom.xml | 12 ------- .../camel-k-quarkus-loader-xml/deployment/pom.xml | 12 ------- .../camel-k-quarkus-loader-yaml/deployment/pom.xml | 12 ------- .../quarkus/deployment/DeploymentProcessor.java | 3 +- .../camel-k-runtime-quarkus/deployment/pom.xml | 16 +++------ .../k/quarkus/deployment/DeploymentProcessor.java | 41 ++++++++++++++++++---- .../camel-k-runtime-quarkus/runtime/pom.xml | 4 +++ .../k/quarkus/ApplicationListenerAdapter.java} | 10 +++--- .../camel/k/quarkus/ApplicationRecorder.java} | 21 +++++------ .../data/application.properties | 4 +-- .../pom.xml | 1 + .../camel-k-runtime-example-quarkus-xml/pom.xml | 1 + .../data/application.properties | 2 +- .../camel-k-runtime-example-quarkus-yaml/pom.xml | 1 + .../src/main/resources/conf/application.properties | 5 +-- pom.xml | 10 +++--- 29 files changed, 86 insertions(+), 199 deletions(-) diff --git a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/GroovySourceLoader.groovy b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/GroovySourceLoader.groovy index 03db32b..f0e2fc8 100644 --- a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/GroovySourceLoader.groovy +++ b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/GroovySourceLoader.groovy @@ -44,8 +44,7 @@ class GroovySourceLoader implements SourceLoader { cc.addCompilationCustomizers(ic) cc.setScriptBaseClass(DelegatingScript.class.getName()) - def cl = Thread.currentThread().getContextClassLoader() - def sh = new GroovyShell(cl, new Binding(), cc) + def sh = new GroovyShell(new Binding(), cc) def is = source.resolveAsInputStream(getContext()) is.withCloseable { diff --git a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/LoaderTest.groovy b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/LoaderTest.groovy index 4fa9e24..c637fda 100644 --- a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/LoaderTest.groovy +++ b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/LoaderTest.groovy @@ -74,10 +74,10 @@ class LoaderTest extends Specification { routes.size() == 1 with(routes[0].input, FromDefinition) { - it.endpointUri == 'timer:tick?period=1s' + it.endpointUri == 'timer://tick?period=1s' } with(routes[0].outputs[0], ToDefinition) { - it.endpointUri == 'log:info' + it.endpointUri == 'log://info' } } } diff --git a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy index 409705e..11f29ac 100644 --- a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy +++ b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy @@ -181,10 +181,10 @@ class IntegrationTest extends Specification { context.start() then: context.routes?.size() == 1 - context.routes[0].routeContext.getOnException('my-on-exception') != null - context.routes[0].routeContext.getOnException('my-on-exception') instanceof FatalFallbackErrorHandler + context.routes[0].getOnException('my-on-exception') != null + context.routes[0].getOnException('my-on-exception') instanceof FatalFallbackErrorHandler - def eh = context.routes[0].routeContext.getOnException('my-on-exception') as FatalFallbackErrorHandler + def eh = context.routes[0].getOnException('my-on-exception') as FatalFallbackErrorHandler def ch = eh.processor as DefaultChannel ch.output instanceof SendProcessor diff --git a/camel-k-main/camel-k-runtime-health/pom.xml b/camel-k-main/camel-k-runtime-health/pom.xml index 17194fc..c66c7e9 100644 --- a/camel-k-main/camel-k-runtime-health/pom.xml +++ b/camel-k-main/camel-k-runtime-health/pom.xml @@ -40,6 +40,10 @@ <artifactId>camel-core-engine</artifactId> </dependency> <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-health</artifactId> + </dependency> + <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-runtime-core</artifactId> </dependency> diff --git a/camel-k-main/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthContextCustomizer.java b/camel-k-main/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthContextCustomizer.java index b143c90..b5e5086 100644 --- a/camel-k-main/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthContextCustomizer.java +++ b/camel-k-main/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthContextCustomizer.java @@ -94,7 +94,7 @@ public class HealthContextCustomizer implements ContextCustomizer { try { HealthCheckRegistry reg = HealthCheckRegistry.get(camelContext); if (includeRoutes) { - reg.addRepository(new RoutesHealthCheckRepository()); + reg.register(new RoutesHealthCheckRepository()); } if (includeContext) { ContextHealthCheck contextHealthCheck = new ContextHealthCheck(); diff --git a/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml index ff2f4e3..6468aa6 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-core-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java index 8d8ce8f..3f4a853 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java @@ -16,9 +16,7 @@ */ package org.apache.camel.k.core.quarkus.deployment; -import java.util.ArrayList; import java.util.List; -import java.util.ServiceLoader; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -28,12 +26,10 @@ import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import org.apache.camel.k.Constants; -import org.apache.camel.k.Runtime; import org.apache.camel.k.core.quarkus.RuntimeRecorder; import org.apache.camel.quarkus.core.deployment.spi.CamelContextCustomizerBuildItem; -import org.apache.camel.quarkus.core.deployment.spi.CamelMainListenerBuildItem; +import org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination; import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem; -import org.apache.camel.spi.HasId; import org.apache.camel.spi.StreamCachingStrategy; import org.jboss.jandex.IndexView; @@ -44,12 +40,12 @@ public class DeploymentProcessor { List<CamelServicePatternBuildItem> servicePatterns() { return List.of( new CamelServicePatternBuildItem( - CamelServicePatternBuildItem.CamelServiceDestination.REGISTRY, + CamelServiceDestination.REGISTRY, true, Constants.SOURCE_LOADER_RESOURCE_PATH + "/*", Constants.CONTEXT_CUSTOMIZER_RESOURCE_PATH + "/*"), new CamelServicePatternBuildItem( - CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY, + CamelServiceDestination.DISCOVERY, true, Constants.SOURCE_LOADER_INTERCEPTOR_RESOURCE_PATH + "/*") ); @@ -116,27 +112,6 @@ public class DeploymentProcessor { @Record(ExecutionTime.STATIC_INIT) @BuildStep - CamelMainListenerBuildItem registerListener(RuntimeRecorder recorder) { - List<Runtime.Listener> listeners = new ArrayList<>(); - ServiceLoader.load(Runtime.Listener.class).forEach(listener -> { - if (listener instanceof HasId) { - String id = ((HasId) listener).getId(); - if (!id.endsWith(".")) { - id = id + "."; - } - - // TODO: this has to be done at runtime - //PropertiesSupport.bindProperties(getCamelContext(), listener, id); - } - - listeners.add(listener); - }); - - return new CamelMainListenerBuildItem(recorder.createMainListener(listeners)); - } - - @Record(ExecutionTime.STATIC_INIT) - @BuildStep void customizeContext(RuntimeRecorder recorder, BuildProducer<CamelContextCustomizerBuildItem> customizers) { customizers.produce(new CamelContextCustomizerBuildItem(recorder.registerCompositeClassLoader())); } diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java index c02441b..aae6a37 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java +++ b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java @@ -16,22 +16,14 @@ */ package org.apache.camel.k.core.quarkus; -import java.util.List; - import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.annotations.Recorder; import org.apache.camel.CamelContext; import org.apache.camel.k.CompositeClassloader; -import org.apache.camel.k.Runtime; -import org.apache.camel.main.MainListener; import org.apache.camel.quarkus.core.CamelContextCustomizer; @Recorder public class RuntimeRecorder { - public RuntimeValue<MainListener> createMainListener(List<Runtime.Listener> listeners) { - return new RuntimeValue<>(new RuntimeListenerAdapter(listeners)); - } - public RuntimeValue<CamelContextCustomizer> registerCompositeClassLoader() { return new RuntimeValue<>(new CamelContextCustomizer() { @Override diff --git a/camel-k-quarkus/camel-k-quarkus-cron/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-cron/deployment/pom.xml index 2692117..dc75079 100644 --- a/camel-k-quarkus/camel-k-quarkus-cron/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-cron/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-cron-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-knative/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-knative/deployment/pom.xml index aee062d..0be3336 100644 --- a/camel-k-quarkus/camel-k-quarkus-knative/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-knative/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-knative-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-groovy/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-groovy/deployment/pom.xml index 786c051..527ff7a 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-groovy/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-groovy/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-loader-groovy-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-java/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-java/deployment/pom.xml index 0802329..75154aa 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-java/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-java/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-loader-java-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/pom.xml index 98c5f65..3e87c38 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-loader-js-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml index 0a196be..006a727 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-loader-kotlin-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml index aaee4d2..fb637ed 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-quarkus-loader-xml-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.quarkus</groupId> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/pom.xml index a3f917b..afe45c9 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/pom.xml @@ -26,18 +26,6 @@ <modelVersion>4.0.0</modelVersion> <artifactId>camel-k-quarkus-loader-yaml-deployment</artifactId> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java index 0159a0a..cbe86d3 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java @@ -28,6 +28,7 @@ import org.apache.camel.k.loader.yaml.spi.StepParser; import org.apache.camel.model.DataFormatDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.language.ExpressionDefinition; +import org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination; import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; @@ -46,7 +47,7 @@ public class DeploymentProcessor { @BuildStep CamelServicePatternBuildItem servicePatterns() { return new CamelServicePatternBuildItem( - CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY, + CamelServiceDestination.DISCOVERY, true, StepParser.SERVICE_LOCATION + "/*"); } diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/pom.xml b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/pom.xml index 3d17668..10dac08 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/pom.xml @@ -27,18 +27,6 @@ <artifactId>camel-k-runtime-quarkus-deployment</artifactId> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bom-deployment</artifactId> - <version>${camel-quarkus.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.apache.camel.k</groupId> @@ -50,6 +38,10 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-main-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bean-deployment</artifactId> </dependency> </dependencies> diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java index c35b6f7..3136a69 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java @@ -16,19 +16,46 @@ */ package org.apache.camel.k.quarkus.deployment; +import java.util.ArrayList; import java.util.List; +import java.util.ServiceLoader; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import org.apache.camel.k.Runtime; +import org.apache.camel.k.quarkus.ApplicationRecorder; +import org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination; import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem; +import org.apache.camel.quarkus.main.CamelMainApplication; +import org.apache.camel.quarkus.main.deployment.spi.CamelMainListenerBuildItem; +import org.apache.camel.spi.HasId; public class DeploymentProcessor { @BuildStep - public List<CamelServicePatternBuildItem> factoryPatterns() { - return List.of( - new CamelServicePatternBuildItem( - CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY, - true, - "META-INF/services/org/apache/camel/rest/*", - "META-INF/services/org/apache/camel/restapi/*")); + public ReflectiveClassBuildItem reflectiveClasses() { + return new ReflectiveClassBuildItem(true, false, CamelMainApplication.class); + } + + @Record(ExecutionTime.STATIC_INIT) + @BuildStep + CamelMainListenerBuildItem registerListener(ApplicationRecorder recorder) { + List<Runtime.Listener> listeners = new ArrayList<>(); + ServiceLoader.load(Runtime.Listener.class).forEach(listener -> { + if (listener instanceof HasId) { + String id = ((HasId) listener).getId(); + if (!id.endsWith(".")) { + id = id + "."; + } + + // TODO: this has to be done at runtime + //PropertiesSupport.bindProperties(getCamelContext(), listener, id); + } + + listeners.add(listener); + }); + + return new CamelMainListenerBuildItem(recorder.createMainListener(listeners)); } } diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/pom.xml b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/pom.xml index 8bc8bd9..dd308ce 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/pom.xml @@ -36,6 +36,10 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bean</artifactId> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-main</artifactId> + </dependency> </dependencies> <build> diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationListenerAdapter.java similarity index 94% rename from camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java rename to camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationListenerAdapter.java index 20445f1..21b9321 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationListenerAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.k.core.quarkus; +package org.apache.camel.k.quarkus; import java.util.ArrayList; import java.util.Comparator; @@ -30,16 +30,16 @@ import org.apache.camel.main.MainListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class RuntimeListenerAdapter implements MainListener { - private static final Logger LOGGER = LoggerFactory.getLogger(RuntimeListenerAdapter.class); +public class ApplicationListenerAdapter implements MainListener { + private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationListenerAdapter.class); private final List<Runtime.Listener> listeners; - public RuntimeListenerAdapter() { + public ApplicationListenerAdapter() { this.listeners = new ArrayList<>(); } - public RuntimeListenerAdapter(List<Runtime.Listener> listeners) { + public ApplicationListenerAdapter(List<Runtime.Listener> listeners) { this.listeners = new ArrayList<>(listeners); } diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRecorder.java similarity index 59% copy from camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java copy to camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRecorder.java index c35b6f7..587dd9b 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRecorder.java @@ -14,21 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.k.quarkus.deployment; +package org.apache.camel.k.quarkus; import java.util.List; -import io.quarkus.deployment.annotations.BuildStep; -import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem; +import io.quarkus.runtime.RuntimeValue; +import io.quarkus.runtime.annotations.Recorder; +import org.apache.camel.k.Runtime; +import org.apache.camel.main.MainListener; -public class DeploymentProcessor { - @BuildStep - public List<CamelServicePatternBuildItem> factoryPatterns() { - return List.of( - new CamelServicePatternBuildItem( - CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY, - true, - "META-INF/services/org/apache/camel/rest/*", - "META-INF/services/org/apache/camel/restapi/*")); +@Recorder +public class ApplicationRecorder { + public RuntimeValue<MainListener> createMainListener(List<Runtime.Listener> listeners) { + return new RuntimeValue<>(new ApplicationListenerAdapter(listeners)); } } diff --git a/examples/camel-k-runtime-example-api/data/application.properties b/examples/camel-k-runtime-example-api/data/application.properties index 5493f7e..fcd774d 100644 --- a/examples/camel-k-runtime-example-api/data/application.properties +++ b/examples/camel-k-runtime-example-api/data/application.properties @@ -28,9 +28,9 @@ camel.main.stream-caching-enabled = true camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k # -# camel - main +# camel - rest # -camel.context.rest-configuration.api-context-path=/api-doc +camel.rest.api-context-path=/api-doc # # Camel K diff --git a/examples/camel-k-runtime-example-quarkus-knative/pom.xml b/examples/camel-k-runtime-example-quarkus-knative/pom.xml index 04f473c..9554034 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-knative/pom.xml @@ -142,6 +142,7 @@ </executions> <configuration> <executable>${project.build.directory}/${project.artifactId}-runner</executable> + <arguments combine.self="override"/> <workingDirectory>${project.basedir}</workingDirectory> <environmentVariables> <CAMEL_K_CONF>${project.basedir}/data/application.properties</CAMEL_K_CONF> diff --git a/examples/camel-k-runtime-example-quarkus-xml/pom.xml b/examples/camel-k-runtime-example-quarkus-xml/pom.xml index 38ca724..a8c5569 100644 --- a/examples/camel-k-runtime-example-quarkus-xml/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-xml/pom.xml @@ -143,6 +143,7 @@ </executions> <configuration> <executable>${project.build.directory}/${project.artifactId}-runner</executable> + <arguments combine.self="override"/> <workingDirectory>${project.basedir}</workingDirectory> <environmentVariables> <CAMEL_K_CONF>${project.basedir}/data/application.properties</CAMEL_K_CONF> diff --git a/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties b/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties index 5d62cff..70e98f8 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties +++ b/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties @@ -31,7 +31,7 @@ camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q # # Camel - rest # -camel.context.rest-configuration.component = platform-http +camel.rest.component = platform-http # # Integration diff --git a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml index 42ff7e4..78c8235 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml @@ -169,6 +169,7 @@ </executions> <configuration> <executable>${project.build.directory}/${project.artifactId}-runner</executable> + <arguments combine.self="override"/> <workingDirectory>${project.basedir}</workingDirectory> <environmentVariables> <CAMEL_K_CONF>${project.basedir}/data/application.properties</CAMEL_K_CONF> diff --git a/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties b/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties index fbb9d81..ad22a27 100644 --- a/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties +++ b/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties @@ -26,10 +26,11 @@ logging.level.org.apache.camel.k = DEBUG camel.main.name = camel-k camel.main.stream-caching-enabled = true camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k + # # Camel - rest # -camel.context.rest-configuration.component = platform-http +camel.rest.component = platform-http # # camel-k - platform http @@ -40,4 +41,4 @@ camel.k.customizer.platform-http.bind-port = 8080 # # Integration # -message = test-app \ No newline at end of file +message = test-app diff --git a/pom.xml b/pom.xml index 209b5f2..257798d 100644 --- a/pom.xml +++ b/pom.xml @@ -39,8 +39,8 @@ <maven.compiler.target>11</maven.compiler.target> <kotlin.compiler.target>1.8</kotlin.compiler.target> - <camel.version>3.3.0</camel.version> - <camel-quarkus.version>1.0.0-CR2</camel-quarkus.version> + <camel.version>3.4.0</camel.version> + <camel-quarkus.version>1.0.0-CR3</camel-quarkus.version> <catalog.version>${camel.version}</catalog.version> <junit.version>5.6.2</junit.version> <joor.version>0.9.13</joor.version> @@ -54,15 +54,15 @@ <groovy.version>3.0.4</groovy.version> <kotlin.version>1.3.72</kotlin.version> <snakeyaml.version>1.26</snakeyaml.version> - <spock.version>2.0-M2-groovy-3.0</spock.version> + <spock.version>2.0-M3-groovy-3.0</spock.version> <jackson.version>2.10.4</jackson.version> <jaxb-api.version>2.3.0</jaxb-api.version> <jaxb-core.version>2.3.0.1</jaxb-core.version> <immutables.version>2.8.8</immutables.version> <semver4j.version>3.1.0</semver4j.version> <vertx.version>3.9.0</vertx.version> - <graalvm.version>19.3.1</graalvm.version> - <quarkus.version>1.5.0.Final</quarkus.version> + <graalvm.version>20.1.0</graalvm.version> + <quarkus.version>1.6.0.Final</quarkus.version> <jandex.version>2.1.3.Final</jandex.version> <javapoet.version>1.11.1</javapoet.version> <rest-assured.version>4.3.1</rest-assured.version>