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 2bd60adb9..11da9a7f1 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 @@ -45,7 +45,7 @@ class IntegrationTest extends Specification { def setup() { this.context = new DefaultCamelContext() - this.runtime = Runtime.of(context) + this.runtime = Runtime.on(context) } diff --git a/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java b/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java index 156f0af1b..7365a98e8 100644 --- a/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java +++ b/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java @@ -44,7 +44,7 @@ public class IntegrationTest { @BeforeEach public void setUp() { this.context = new DefaultCamelContext(); - this.runtime = Runtime.of(context); + this.runtime = Runtime.on(context); } @AfterEach diff --git a/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt b/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt index 66702db16..1115ea603 100644 --- a/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt +++ b/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt @@ -38,7 +38,7 @@ class IntegrationTest { @Test fun `load integration with rest`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-rest.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) @@ -74,7 +74,7 @@ class IntegrationTest { @Test fun `load integration with beans`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-beans.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) @@ -89,7 +89,7 @@ class IntegrationTest { @Test fun `load integration with components configuration`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-components-configuration.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) @@ -107,7 +107,7 @@ class IntegrationTest { @Test fun `load integration with languages configuration`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-languages-configuration.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) @@ -123,7 +123,7 @@ class IntegrationTest { @Test fun `load integration with dataformats configuration`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-dataformats-configuration.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) @@ -139,7 +139,7 @@ class IntegrationTest { @Test fun `load integration with error handler`() { val context = DefaultCamelContext() - val runtime = Runtime.of(context) + val runtime = Runtime.on(context) forRoutes("classpath:routes-with-error-handler.kts").accept(Runtime.Phase.ConfigureRoutes, runtime) 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 127fed1a3..313aea5ea 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 @@ -25,10 +25,9 @@ import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; -import io.quarkus.deployment.builditem.substrate.ServiceProviderBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import org.apache.camel.k.Runtime; -import org.apache.camel.k.core.quarkus.RuntimeListenerAdapter; import org.apache.camel.k.core.quarkus.RuntimeRecorder; import org.apache.camel.quarkus.core.deployment.CamelMainListenerBuildItem; import org.apache.camel.spi.HasId; @@ -96,7 +95,7 @@ void registerStreamCachingClasses( ); } - @Record(ExecutionTime.RUNTIME_INIT) + @Record(ExecutionTime.STATIC_INIT) @BuildStep CamelMainListenerBuildItem registerListener(RuntimeRecorder recorder) { List listeners = new ArrayList<>(); @@ -107,16 +106,13 @@ CamelMainListenerBuildItem registerListener(RuntimeRecorder recorder) { id = id + "."; } - // TODO: this has to be done on quarkus side + // TODO: this has to be done at runtime //PropertiesSupport.bindProperties(getCamelContext(), listener, id); } listeners.add(listener); }); - RuntimeListenerAdapter adapter = new RuntimeListenerAdapter(); - adapter.setListeners(listeners); - - return new CamelMainListenerBuildItem(adapter); + return new CamelMainListenerBuildItem(recorder.createMainListener(listeners)); } } diff --git a/camel-k-quarkus/camel-k-quarkus-core/it/src/test/java/org/apache/camel/k/core/quarkus/deployment/ExtensionIT.java b/camel-k-quarkus/camel-k-quarkus-core/it/src/test/java/org/apache/camel/k/core/quarkus/deployment/ExtensionIT.java index 5ed3c9554..5b75cc4aa 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/it/src/test/java/org/apache/camel/k/core/quarkus/deployment/ExtensionIT.java +++ b/camel-k-quarkus/camel-k-quarkus-core/it/src/test/java/org/apache/camel/k/core/quarkus/deployment/ExtensionIT.java @@ -16,8 +16,8 @@ */ package org.apache.camel.k.core.quarkus.deployment; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class ExtensionIT extends ExtensionTest { } \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml index 7e1e05f25..bdb136152 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml @@ -28,14 +28,32 @@ camel-k-quarkus-core + + org.apache.camel + camel-support + + + org.apache.camel + camel-core-engine + org.apache.camel.k camel-k-runtime-core + + + javax.xml.bind + jaxb-api + + org.apache.camel.quarkus camel-quarkus-core + + org.jboss.spec.javax.xml.bind + jboss-jaxb-api_2.3_spec + 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-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java index 50662f287..2ca4f0996 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-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java @@ -49,91 +49,52 @@ public List getListeners() { @Override public void beforeStart(BaseMainSupport main) { - final Runtime runtime = new Runtime() { - @Override - public CamelContext getCamelContext() { - return main.getCamelContext(); - } - - @Override - public void addRoutes(RoutesBuilder builder) { - try { - // TODO: the before start event is fired in the wrong - // phase in camek-quarkus so routes have to be - // added directly to the registry, eplace with: - // main.addRoutesBuilder(builder) - // when fixed. - main.getCamelContext().addRoutes(builder); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - invokeListeners(runtime, Runtime.Phase.Starting); - invokeListeners(runtime, Runtime.Phase.ConfigureRoutes); + invokeListeners(listeners, on(main), Runtime.Phase.Starting); + invokeListeners(listeners, on(main), Runtime.Phase.ConfigureRoutes); } @Override public void configure(CamelContext context) { - invokeListeners(Runtime.of(context), Runtime.Phase.ConfigureContext); + invokeListeners(listeners, on(context), Runtime.Phase.ConfigureContext); } @Override public void afterStart(BaseMainSupport main) { - final Runtime runtime = new Runtime() { - @Override - public CamelContext getCamelContext() { - return main.getCamelContext(); - } - - @Override - public void addRoutes(RoutesBuilder builder) { - try { - // TODO: the before start event is fired in the wrong - // phase in camek-quarkus so routes have to be - // added directly to the registry, eplace with: - // main.addRoutesBuilder(builder) - // when fixed. - main.getCamelContext().addRoutes(builder); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - invokeListeners(runtime, Runtime.Phase.Started); + invokeListeners(listeners, on(main), Runtime.Phase.Started); } @Override public void beforeStop(BaseMainSupport main) { - final Runtime runtime = new Runtime() { - @Override - public CamelContext getCamelContext() { - return main.getCamelContext(); - } + invokeListeners(listeners, on(main), Runtime.Phase.Stopping); + } - @Override - public void addRoutes(RoutesBuilder builder) { - try { - // TODO: the before start event is fired in the wrong - // phase in camek-quarkus so routes have to be - // added directly to the registry, eplace with: - // main.addRoutesBuilder(builder) - // when fixed. - main.getCamelContext().addRoutes(builder); - } catch (Exception e) { - throw new RuntimeException(e); + @Override + public void afterStop(BaseMainSupport main) { + invokeListeners(listeners, on(main), Runtime.Phase.Stopped); + } + + // ************************ + // + // Helpers + // + // ************************ + + private static void invokeListeners(List listeners, Runtime runtime, Runtime.Phase phase) { + listeners.stream() + .sorted(Comparator.comparingInt(Runtime.Listener::getOrder)) + .forEach(l -> { + if (l.accept(phase, runtime)) { + LOGGER.info("Listener {} executed in phase {}", l, phase); } - } - }; + }); + } - invokeListeners(runtime, Runtime.Phase.Stopping); + private static Runtime on(CamelContext context) { + return Runtime.on(context); } - @Override - public void afterStop(BaseMainSupport main) { - final Runtime runtime = new Runtime() { + private static Runtime on(BaseMainSupport main) { + return new Runtime() { @Override public CamelContext getCamelContext() { return main.getCamelContext(); @@ -141,29 +102,8 @@ public CamelContext getCamelContext() { @Override public void addRoutes(RoutesBuilder builder) { - try { - // TODO: the before start event is fired in the wrong - // phase in camek-quarkus so routes have to be - // added directly to the registry, eplace with: - // main.addRoutesBuilder(builder) - // when fixed. - main.getCamelContext().addRoutes(builder); - } catch (Exception e) { - throw new RuntimeException(e); - } + main.addRoutesBuilder(builder); } }; - - invokeListeners(runtime, Runtime.Phase.Stopped); - } - - private void invokeListeners(Runtime runtime, Runtime.Phase phase) { - listeners.stream() - .sorted(Comparator.comparingInt(Runtime.Listener::getOrder)) - .forEach(l -> { - if (l.accept(phase, runtime)) { - LOGGER.info("Listener {} executed in phase {}", l, phase); - } - }); } } 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 33a2bbab4..4d0a9a07f 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,8 +16,19 @@ */ 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.k.Runtime; +import org.apache.camel.main.MainListener; @Recorder public class RuntimeRecorder { + public RuntimeValue createMainListener(List listeners) { + RuntimeListenerAdapter adapter = new RuntimeListenerAdapter(); + adapter.setListeners(listeners); + + return new RuntimeValue<>(adapter); + } } diff --git a/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java index fe7f5e042..e5851d9db 100644 --- a/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java @@ -18,10 +18,38 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.vertx.deployment.VertxBuildItem; +import org.apache.camel.component.knative.KnativeComponent; import org.apache.camel.component.knative.spi.KnativeEnvironment; +import org.apache.camel.k.quarkus.knative.KnativeRecorder; +import org.apache.camel.quarkus.core.CamelServiceFilter; +import org.apache.camel.quarkus.core.deployment.CamelRuntimeBeanBuildItem; +import org.apache.camel.quarkus.core.deployment.CamelServiceFilterBuildItem; public class DeploymentProcessor { + @BuildStep + void servicesFilters(BuildProducer serviceFilter) { + serviceFilter.produce( + new CamelServiceFilterBuildItem(CamelServiceFilter.forComponent("knative")) + ); + serviceFilter.produce( + new CamelServiceFilterBuildItem(CamelServiceFilter.forPathEndingWith(CamelServiceFilter.CAMEL_SERVICE_BASE_PATH + "/knative/transport/http")) + ); + } + + @Record(ExecutionTime.RUNTIME_INIT) + @BuildStep + CamelRuntimeBeanBuildItem knativeComponent(KnativeRecorder recorder, VertxBuildItem vertx) { + return new CamelRuntimeBeanBuildItem( + "knative", + KnativeComponent.class, + recorder.createKnativeComponent(vertx.getVertx()) + ); + } + @BuildStep void registerReflectiveClasses(BuildProducer reflectiveClass) { reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, KnativeEnvironment.class)); diff --git a/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml index 01aef0cc0..9126a12eb 100644 --- a/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml @@ -29,34 +29,25 @@ - org.apache.camel - camel-http-common - - - - org.apache.camel.k - camel-k-runtime-core - - - org.apache.camel.k - camel-k-runtime-knative + io.quarkus + quarkus-vertx - org.apache.camel.k camel-k-quarkus-core - org.apache.camel.quarkus camel-quarkus-core-cloud - - io.quarkus - quarkus-vertx + org.apache.camel.k + camel-k-runtime-knative + + + org.apache.camel + camel-http-common - com.oracle.substratevm svm diff --git a/camel-k-quarkus/camel-k-quarkus-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java b/camel-k-quarkus/camel-k-quarkus-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java new file mode 100644 index 000000000..076880195 --- /dev/null +++ b/camel-k-quarkus/camel-k-quarkus-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.k.quarkus.knative; + +import io.quarkus.runtime.RuntimeValue; +import io.quarkus.runtime.annotations.Recorder; +import io.vertx.core.Vertx; +import org.apache.camel.component.knative.KnativeComponent; +import org.apache.camel.component.knative.http.KnativeHttpTransport; + +@Recorder +public class KnativeRecorder { + public RuntimeValue createKnativeComponent(RuntimeValue vertx) { + KnativeHttpTransport transport = new KnativeHttpTransport(); + transport.setVertx(vertx.getValue()); + + KnativeComponent component = new KnativeComponent(); + component.setTransport(transport); + + return new RuntimeValue<>(component); + } +} diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/DeploymentProcessor.java index 741c532e8..afa19b6dc 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/DeploymentProcessor.java @@ -34,7 +34,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import org.apache.camel.Exchange; import org.apache.camel.NamedNode; import org.apache.camel.builder.DataFormatClause; diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionIT.java b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionIT.java index 0f6b784e0..19ca08463 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionIT.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionIT.java @@ -16,8 +16,8 @@ */ package org.apache.camel.k.loader.js.quarkus.deployment; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class ExtensionIT extends ExtensionTest { } \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml index 322ee42fa..50bf94e2c 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml @@ -29,13 +29,9 @@ - org.apache.camel - camel-support - - - org.apache.camel - camel-core-engine - + org.apache.camel.k + camel-k-quarkus-core + org.apache.camel camel-endpointdsl @@ -44,10 +40,6 @@ org.apache.camel.k camel-k-loader-js - - org.apache.camel.k - camel-k-quarkus-core - diff --git a/camel-k-quarkus/camel-k-quarkus-loader-knative/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-knative/runtime/pom.xml index b3766d248..aec4d280a 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-knative/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-knative/runtime/pom.xml @@ -28,21 +28,13 @@ camel-k-quarkus-loader-knative - - org.apache.camel - camel-support - - - org.apache.camel - camel-core-engine - org.apache.camel.k - camel-k-loader-knative + camel-k-quarkus-core org.apache.camel.k - camel-k-quarkus-core + camel-k-loader-knative diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionIT.java b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionIT.java index 721f00d2c..c0fee9cc2 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionIT.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionIT.java @@ -16,8 +16,8 @@ */ package org.apache.camel.k.loader.xml.quarkus.deployment; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class ExtensionIT extends ExtensionTest { } \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml index 460d8be76..f79796131 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml @@ -28,14 +28,6 @@ camel-k-quarkus-loader-xml - - org.apache.camel - camel-support - - - org.apache.camel.k - camel-k-loader-xml - org.apache.camel.k camel-k-quarkus-core @@ -44,6 +36,10 @@ org.apache.camel.quarkus camel-quarkus-core-xml + + org.apache.camel.k + camel-k-loader-xml + 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 7089c6659..b81006a1b 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 @@ -19,7 +19,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import org.apache.camel.k.loader.yaml.model.Node; import org.apache.camel.k.loader.yaml.model.Step; import org.apache.camel.k.loader.yaml.parser.HasDataFormat; diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionIT.java b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionIT.java index 4ca41e02c..80588b252 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionIT.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionIT.java @@ -16,8 +16,8 @@ */ package org.apache.camel.k.loader.yaml.quarkus.deployment; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class ExtensionIT extends ExtensionTest { } \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-yaml/runtime/pom.xml index 444679510..80a3f520d 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/runtime/pom.xml @@ -28,21 +28,13 @@ camel-k-quarkus-loader-yaml - - org.apache.camel - camel-support - - - org.apache.camel - camel-core-engine - org.apache.camel.k - camel-k-loader-yaml + camel-k-quarkus-core org.apache.camel.k - camel-k-quarkus-core + camel-k-loader-yaml 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 6650cdc4b..6f71be3a5 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 @@ -18,7 +18,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.runtime.configuration.TemporaryConfigSourceProvider; public class DeploymentProcessor { diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java index 3097bb71d..a7990fea2 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java @@ -78,7 +78,7 @@ default int getOrder() { * @param camelContext the camel context * @return the runtime */ - static Runtime of(CamelContext camelContext) { + static Runtime on(CamelContext camelContext) { return () -> camelContext; } @@ -88,7 +88,7 @@ static Runtime of(CamelContext camelContext) { * @param provider the camel context provider * @return the runtime */ - static Runtime of(HasCamelContext provider) { + static Runtime on(HasCamelContext provider) { return () -> provider.getCamelContext(); } } diff --git a/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java b/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java index 732157ba0..5946a96ae 100644 --- a/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java +++ b/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java @@ -32,7 +32,7 @@ public class HealthCustomizerTest { @Test public void testServletConfigurer() { - Runtime runtime = Runtime.of(new DefaultCamelContext()); + Runtime runtime = Runtime.on(new DefaultCamelContext()); HealthContextCustomizer healthCustomizer = new HealthContextCustomizer(); healthCustomizer.apply(runtime.getCamelContext()); diff --git a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java index cefb571e0..0cc7ca75b 100644 --- a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java +++ b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java @@ -31,7 +31,7 @@ public class ServletCustomizerTest { @Test public void testServletConfigurer() { - Runtime runtime = Runtime.of(new DefaultCamelContext()); + Runtime runtime = Runtime.on(new DefaultCamelContext()); ServletRegistrationContextCustomizer servletRegistrationCustomizer = new ServletRegistrationContextCustomizer("/webhook/*", "webhook-servlet"); servletRegistrationCustomizer.apply(runtime.getCamelContext()); diff --git a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java index e4cc86241..2c3eea963 100644 --- a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java +++ b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java @@ -31,7 +31,7 @@ public class ServletRegistrationCustomizerTest { @Test public void testServletRegistrationConfigurer() { - Runtime runtime = Runtime.of(new DefaultCamelContext()); + Runtime runtime = Runtime.on(new DefaultCamelContext()); ServletRegistrationContextCustomizer servletRegistrationCustomizer = new ServletRegistrationContextCustomizer(); servletRegistrationCustomizer.apply(runtime.getCamelContext()); diff --git a/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java b/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java index 0091dcb2d..3759ccc66 100644 --- a/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java +++ b/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java @@ -123,6 +123,10 @@ public void handle(HttpServerRequest request) { }); } catch (Exception e) { getExceptionHandler().handleException(e); + + request.response().setStatusCode(500); + request.response().putHeader(Exchange.CONTENT_TYPE, "text/plain"); + request.response().end(e.getMessage()); } finally { doneUoW(exchange); } diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java index 6458c09ee..8a2329aff 100644 --- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java +++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java @@ -173,13 +173,13 @@ protected void doInit() throws Exception { .newInstance(protocol.name(), KnativeTransport.class) .orElseThrow(() -> new RuntimeException("Error creating knative transport for protocol: " + protocol.name())); } + } - if (this.transport instanceof CamelContextAware) { - CamelContextAware camelContextAware = (CamelContextAware)this.transport; + if (this.transport instanceof CamelContextAware) { + CamelContextAware camelContextAware = (CamelContextAware)this.transport; - if (camelContextAware.getCamelContext() == null) { - camelContextAware.setCamelContext(getCamelContext()); - } + if (camelContextAware.getCamelContext() == null) { + camelContextAware.setCamelContext(getCamelContext()); } } diff --git a/examples/camel-k-runtime-example-quarkus-js/data/application.properties b/examples/camel-k-runtime-example-quarkus-js/data/application.properties index 694130350..b5802cec1 100644 --- a/examples/camel-k-runtime-example-quarkus-js/data/application.properties +++ b/examples/camel-k-runtime-example-quarkus-js/data/application.properties @@ -1,2 +1,29 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +# +# camel - main +# +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q + +# +# Integration +# message = test-xs + diff --git a/examples/camel-k-runtime-example-quarkus-js/data/routes.js b/examples/camel-k-runtime-example-quarkus-js/data/routes.js index 63acd074c..8a8651686 100644 --- a/examples/camel-k-runtime-example-quarkus-js/data/routes.js +++ b/examples/camel-k-runtime-example-quarkus-js/data/routes.js @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ from('timer:tick') .to('log:info'); diff --git a/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties index c543799fd..3ac1675c3 100644 --- a/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties @@ -14,18 +14,12 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + # -# quarkus - log +# quarkus # quarkus.log.file.enable = false quarkus.log.console.enable = true quarkus.log.level = INFO quarkus.log.category."org.apache.camel".level = INFO - -# -# camel - main -# -camel.main.name = camel-q -camel.main.stream-caching-enabled = true -camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q diff --git a/examples/camel-k-runtime-example-quarkus-knative/data/application.properties b/examples/camel-k-runtime-example-quarkus-knative/data/application.properties index 2b4aaa276..111c9b666 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/data/application.properties +++ b/examples/camel-k-runtime-example-quarkus-knative/data/application.properties @@ -1,7 +1,24 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- # # camel # camel.context.name = camel-q -camel.context.stream-caching = true -camel.context.stream-caching-strategy.spool-directory = ${java.io.tmpdir}/camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q +#camel.main.autowire-component-properties = false diff --git a/examples/camel-k-runtime-example-quarkus-knative/pom.xml b/examples/camel-k-runtime-example-quarkus-knative/pom.xml index 650d64dd5..c73e4b655 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-knative/pom.xml @@ -53,17 +53,10 @@ org.apache.camel.k camel-k-quarkus-loader-yaml - org.apache.camel.quarkus camel-quarkus-log - - - org.jboss.spec.javax.servlet - jboss-servlet-api_4.0_spec - 1.0.0.Final - diff --git a/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties index 8ddef31b2..3ac1675c3 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties @@ -14,22 +14,12 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + # # quarkus # quarkus.log.file.enable = false - quarkus.log.console.enable = true -quarkus.log.console.level = INFO - -#quarkus.log.category."org.apache.camel.support".level=INFO -quarkus.log.category."org.apache.camel.quarkus".level = DEBUG - -# -# camel - main -# -camel.main.name = camel-q -camel.main.stream-caching-enabled = true -camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q - +quarkus.log.level = INFO +quarkus.log.category."org.apache.camel".level = INFO 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 694130350..b89353108 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties +++ b/examples/camel-k-runtime-example-quarkus-yaml/data/application.properties @@ -1,2 +1,28 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +# +# camel - main +# +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q + +# +# Integration +# message = test-xs diff --git a/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties index 6e9048b87..88c3528b4 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties @@ -22,10 +22,3 @@ quarkus.log.console.enable = true quarkus.log.level = INFO quarkus.log.category."org.apache.camel".level = INFO - -# -# camel - main -# -camel.main.name = camel-q -camel.main.stream-caching-enabled = true -camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q \ No newline at end of file diff --git a/pom.xml b/pom.xml index 731462097..634f27a58 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 1.8 1.8 3.0.0-RC3 - 0.3.0 + 0.3.1 ${camel.version} 5.5.2 0.9.12 @@ -59,7 +59,7 @@ 1.4.26.Final 3.8.3 19.2.0.1 - 0.26.1 + 0.27.0 2.1.1.Final 1.11.1 1.0-rc6 @@ -238,18 +238,6 @@ false - - - apache.staging - https://repository.apache.org/content/repositories/orgapachecamel-1159 - Apache Snapshot Repo - - false - - - true - - @@ -263,17 +251,6 @@ false - - apache.staging - https://repository.apache.org/content/repositories/orgapachecamel-1159 - Apache Snapshot Repo - - false - - - true - -