diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml
index 1518c878b..bbb6b721b 100644
--- a/.github/workflows/ci-build.yml
+++ b/.github/workflows/ci-build.yml
@@ -84,6 +84,8 @@ jobs:
- :camel-k-itests-cron
- :camel-k-itests-kamelet
- :camel-k-itests-knative
+ - :camel-k-itests-knative-producer
+ - :camel-k-itests-knative-consumer
- :camel-k-itests-knative-sinkbinding
- :camel-k-itests-knative-source-js
- :camel-k-itests-knative-source-xml
diff --git a/camel-k-knative/consumer/deployment/pom.xml b/camel-k-knative/consumer/deployment/pom.xml
new file mode 100644
index 000000000..28e3ea378
--- /dev/null
+++ b/camel-k-knative/consumer/deployment/pom.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-knative-consumer-deployment
+
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
+
+ org.apache.camel.quarkus
+ camel-quarkus-core-deployment
+
+
+ io.quarkus
+ quarkus-vertx-http-deployment
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${quarkus-version}
+
+
+
+
+
+
+
+
diff --git a/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerFeature.java b/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerFeature.java
new file mode 100644
index 000000000..667deae45
--- /dev/null
+++ b/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerFeature.java
@@ -0,0 +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.
+ */
+package org.apache.camel.k.quarkus.knative.consumer.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+public class KnativeConsumerFeature {
+ public static final String FEATURE = "camel-k-knative-consumer";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerProcessor.java b/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerProcessor.java
new file mode 100644
index 000000000..b01def6d0
--- /dev/null
+++ b/camel-k-knative/consumer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/consumer/deployment/KnativeConsumerProcessor.java
@@ -0,0 +1,40 @@
+/*
+ * 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.consumer.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.vertx.http.deployment.VertxWebRouterBuildItem;
+import org.apache.camel.k.quarkus.knative.consumer.KnativeConsumerRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem;
+import org.apache.camel.spi.ComponentCustomizer;
+
+public class KnativeConsumerProcessor {
+ @Record(ExecutionTime.RUNTIME_INIT)
+ @BuildStep
+ CamelRuntimeBeanBuildItem knativeComponentCustomizer(
+ KnativeConsumerRecorder recorder,
+ VertxWebRouterBuildItem router) {
+
+ return new CamelRuntimeBeanBuildItem(
+ KnativeConsumerFeature.FEATURE + "-customizer",
+ ComponentCustomizer.class.getName(),
+ recorder.createKnativeConsumerFactoryCustomizer(router.getRouter())
+ );
+ }
+}
diff --git a/camel-k-knative/consumer/pom.xml b/camel-k-knative/consumer/pom.xml
new file mode 100644
index 000000000..e20f5ed2f
--- /dev/null
+++ b/camel-k-knative/consumer/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+ pom
+
+ camel-k-knative-consumer-parent
+
+
+ runtime
+ deployment
+
+
+
+
diff --git a/camel-k-knative/consumer/runtime/pom.xml b/camel-k-knative/consumer/runtime/pom.xml
new file mode 100644
index 000000000..72c51b2ca
--- /dev/null
+++ b/camel-k-knative/consumer/runtime/pom.xml
@@ -0,0 +1,102 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-knative-consumer
+
+
+
+ io.quarkus
+ quarkus-vertx-http
+
+
+ org.apache.camel.quarkus
+ camel-quarkus-core
+
+
+ org.apache.camel.k
+ camel-knative-api
+
+
+ org.apache.camel.k
+ camel-knative
+
+
+ org.apache.camel.k
+ camel-knative-http
+
+
+ org.apache.camel.k
+ camel-k-knative-impl
+
+
+
+
+
+
+ io.quarkus
+ quarkus-bootstrap-maven-plugin
+ ${quarkus-version}
+
+
+
+ extension-descriptor
+
+
+ ${project.groupId}:${project.artifactId}-deployment:${project.version}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${quarkus-version}
+
+
+
+
+
+ org.jboss.jandex
+ jandex-maven-plugin
+
+
+ make-index
+
+ jandex
+
+
+
+
+
+
+
+
diff --git a/camel-k-knative/consumer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/consumer/KnativeConsumerRecorder.java b/camel-k-knative/consumer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/consumer/KnativeConsumerRecorder.java
new file mode 100644
index 000000000..cea933a7c
--- /dev/null
+++ b/camel-k-knative/consumer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/consumer/KnativeConsumerRecorder.java
@@ -0,0 +1,44 @@
+/*
+ * 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.consumer;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import io.vertx.ext.web.Router;
+import org.apache.camel.Component;
+import org.apache.camel.component.knative.KnativeComponent;
+import org.apache.camel.component.knative.http.KnativeHttpConsumerFactory;
+import org.apache.camel.spi.ComponentCustomizer;
+
+@Recorder
+public class KnativeConsumerRecorder {
+ public RuntimeValue createKnativeConsumerFactoryCustomizer(RuntimeValue router) {
+ KnativeHttpConsumerFactory factory = new KnativeHttpConsumerFactory();
+ factory.setRouter(router.getValue());
+
+ ComponentCustomizer cf = new ComponentCustomizer() {
+ @Override
+ public void configure(String name, Component target) {
+ if (target instanceof KnativeComponent) {
+ ((KnativeComponent) target).setConsumerFactory(factory);
+ }
+ }
+ };
+
+ return new RuntimeValue<>(cf);
+ }
+}
diff --git a/camel-k-knative/deployment/pom.xml b/camel-k-knative/deployment/pom.xml
index 31f4edbc5..ccc84afa9 100644
--- a/camel-k-knative/deployment/pom.xml
+++ b/camel-k-knative/deployment/pom.xml
@@ -41,23 +41,6 @@
org.apache.camel.quarkus
camel-quarkus-core-deployment
-
- org.apache.camel.quarkus
- camel-quarkus-core-cloud-deployment
-
-
- org.apache.camel.quarkus
- camel-quarkus-http-common-deployment
-
-
-
- io.quarkus
- quarkus-vertx-core-deployment
-
-
- io.quarkus
- quarkus-vertx-http-deployment
-
diff --git a/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/Feature.java b/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeFeature.java
similarity index 92%
rename from camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/Feature.java
rename to camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeFeature.java
index a3db07cb5..edc4062be 100644
--- a/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/Feature.java
+++ b/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeFeature.java
@@ -19,8 +19,8 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-public class Feature {
- private static final String FEATURE = "camel-k-runtime-knative";
+public class KnativeFeature {
+ private static final String FEATURE = "camel-k-knative";
@BuildStep
FeatureBuildItem feature() {
diff --git a/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java b/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeProcessor.java
similarity index 81%
rename from camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java
rename to camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeProcessor.java
index 877e5b09f..68f42d73a 100644
--- a/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java
+++ b/camel-k-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/KnativeProcessor.java
@@ -23,9 +23,6 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
-import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;
-import io.quarkus.vertx.http.deployment.BodyHandlerBuildItem;
-import io.quarkus.vertx.http.deployment.VertxWebRouterBuildItem;
import org.apache.camel.component.knative.KnativeComponent;
import org.apache.camel.component.knative.KnativeConstants;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
@@ -34,7 +31,7 @@
import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilter;
import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilterBuildItem;
-public class DeploymentProcessor {
+public class KnativeProcessor {
@BuildStep
List unremovableBeans() {
return List.of(
@@ -60,19 +57,11 @@ List servicesFilters() {
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
- CamelRuntimeBeanBuildItem knativeComponent(
- KnativeRecorder recorder,
- CoreVertxBuildItem vertx,
- VertxWebRouterBuildItem router,
- BodyHandlerBuildItem bodyHandlerBuildItem) {
-
+ CamelRuntimeBeanBuildItem knativeComponent(KnativeRecorder recorder) {
return new CamelRuntimeBeanBuildItem(
KnativeConstants.SCHEME,
KnativeComponent.class.getName(),
- recorder.createKnativeComponent(
- vertx.getVertx(),
- router.getRouter(),
- bodyHandlerBuildItem.getHandler())
+ recorder.createKnativeComponent()
);
}
}
diff --git a/camel-k-knative/pom.xml b/camel-k-knative/pom.xml
index deba840e5..5c558d181 100644
--- a/camel-k-knative/pom.xml
+++ b/camel-k-knative/pom.xml
@@ -30,9 +30,10 @@
impl
+ producer
+ consumer
runtime
deployment
-
diff --git a/camel-k-knative/producer/deployment/pom.xml b/camel-k-knative/producer/deployment/pom.xml
new file mode 100644
index 000000000..89f232086
--- /dev/null
+++ b/camel-k-knative/producer/deployment/pom.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-producer-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-knative-producer-deployment
+
+
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.quarkus
+ camel-quarkus-core-deployment
+
+
+ io.quarkus
+ quarkus-vertx-core-deployment
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${quarkus-version}
+
+
+
+
+
+
+
+
diff --git a/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerFeature.java b/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerFeature.java
new file mode 100644
index 000000000..15a4d2fa0
--- /dev/null
+++ b/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerFeature.java
@@ -0,0 +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.
+ */
+package org.apache.camel.k.quarkus.knative.producer.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+public class KnativeProducerFeature {
+ public static final String FEATURE = "camel-k-knative-producer";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerProcessor.java b/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerProcessor.java
new file mode 100644
index 000000000..3b7bd4e21
--- /dev/null
+++ b/camel-k-knative/producer/deployment/src/main/java/org/apache/camel/k/quarkus/knative/producer/deployment/KnativeProducerProcessor.java
@@ -0,0 +1,40 @@
+/*
+ * 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.producer.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;
+import org.apache.camel.k.quarkus.knative.producer.KnativeProducerRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem;
+import org.apache.camel.spi.ComponentCustomizer;
+
+public class KnativeProducerProcessor {
+ @Record(ExecutionTime.RUNTIME_INIT)
+ @BuildStep
+ CamelRuntimeBeanBuildItem knativeComponentCustomizer(
+ KnativeProducerRecorder recorder,
+ CoreVertxBuildItem vertx) {
+
+ return new CamelRuntimeBeanBuildItem(
+ KnativeProducerFeature.FEATURE + "-customizer",
+ ComponentCustomizer.class.getName(),
+ recorder.createKnativeProducerFactoryCustomizer(vertx.getVertx())
+ );
+ }
+}
diff --git a/camel-k-knative/producer/pom.xml b/camel-k-knative/producer/pom.xml
new file mode 100644
index 000000000..36b5e8c2b
--- /dev/null
+++ b/camel-k-knative/producer/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+ pom
+
+ camel-k-knative-producer-parent
+
+
+ runtime
+ deployment
+
+
+
+
diff --git a/camel-k-knative/producer/runtime/pom.xml b/camel-k-knative/producer/runtime/pom.xml
new file mode 100644
index 000000000..3538820d0
--- /dev/null
+++ b/camel-k-knative/producer/runtime/pom.xml
@@ -0,0 +1,98 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-producer-parent
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-knative-producer
+
+
+
+ io.quarkus
+ quarkus-vertx-core
+
+
+ org.apache.camel.quarkus
+ camel-quarkus-core
+
+
+ org.apache.camel.k
+ camel-knative
+
+
+ org.apache.camel.k
+ camel-knative-api
+
+
+ org.apache.camel.k
+ camel-knative-http
+
+
+
+
+
+
+ io.quarkus
+ quarkus-bootstrap-maven-plugin
+ ${quarkus-version}
+
+
+
+ extension-descriptor
+
+
+ ${project.groupId}:${project.artifactId}-deployment:${project.version}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${quarkus-version}
+
+
+
+
+
+ org.jboss.jandex
+ jandex-maven-plugin
+
+
+ make-index
+
+ jandex
+
+
+
+
+
+
+
+
diff --git a/camel-k-knative/producer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/producer/KnativeProducerRecorder.java b/camel-k-knative/producer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/producer/KnativeProducerRecorder.java
new file mode 100644
index 000000000..07aa27c6c
--- /dev/null
+++ b/camel-k-knative/producer/runtime/src/main/java/org/apache/camel/k/quarkus/knative/producer/KnativeProducerRecorder.java
@@ -0,0 +1,46 @@
+/*
+ * 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.producer;
+
+import java.util.function.Supplier;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import io.vertx.core.Vertx;
+import org.apache.camel.Component;
+import org.apache.camel.component.knative.KnativeComponent;
+import org.apache.camel.component.knative.http.KnativeHttpProducerFactory;
+import org.apache.camel.spi.ComponentCustomizer;
+
+@Recorder
+public class KnativeProducerRecorder {
+ public RuntimeValue createKnativeProducerFactoryCustomizer(Supplier vertx) {
+ KnativeHttpProducerFactory factory = new KnativeHttpProducerFactory();
+ factory.setVertx(vertx.get());
+
+ ComponentCustomizer cf = new ComponentCustomizer() {
+ @Override
+ public void configure(String name, Component target) {
+ if (target instanceof KnativeComponent) {
+ ((KnativeComponent) target).setProducerFactory(factory);
+ }
+ }
+ };
+
+ return new RuntimeValue<>(cf);
+ }
+}
diff --git a/camel-k-knative/runtime/pom.xml b/camel-k-knative/runtime/pom.xml
index d4bf7c21a..ec25fa8c6 100644
--- a/camel-k-knative/runtime/pom.xml
+++ b/camel-k-knative/runtime/pom.xml
@@ -28,37 +28,22 @@
camel-k-knative
-
- io.quarkus
- quarkus-vertx-core
-
-
- io.quarkus
- quarkus-vertx-http
-
org.apache.camel.k
camel-k-core
- org.apache.camel.k
- camel-knative-api
-
-
- org.apache.camel.k
- camel-knative
+ org.apache.camel.quarkus
+ camel-quarkus-core
+
org.apache.camel.k
- camel-knative-http
+ camel-knative-api
org.apache.camel.k
- camel-k-knative-impl
-
-
- org.apache.camel.quarkus
- camel-quarkus-http-common
+ camel-knative
diff --git a/camel-k-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java b/camel-k-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java
index edabff7fa..f27531c32 100644
--- a/camel-k-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java
+++ b/camel-k-knative/runtime/src/main/java/org/apache/camel/k/quarkus/knative/KnativeRecorder.java
@@ -16,36 +16,13 @@
*/
package org.apache.camel.k.quarkus.knative;
-import java.util.function.Supplier;
-
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
-import io.vertx.core.Handler;
-import io.vertx.core.Vertx;
-import io.vertx.ext.web.Router;
-import io.vertx.ext.web.RoutingContext;
import org.apache.camel.component.knative.KnativeComponent;
-import org.apache.camel.component.knative.http.KnativeHttpTransport;
-import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter;
@Recorder
public class KnativeRecorder {
- public RuntimeValue createKnativeComponent(
- Supplier vertx,
- RuntimeValue router,
- Handler bodyHandler) {
-
- KnativeHttpTransport transport = new KnativeHttpTransport();
- transport.setRouter(new VertxPlatformHttpRouter(vertx.get(), router.getValue()) {
- @Override
- public Handler bodyHandler() {
- return bodyHandler;
- }
- });
-
- KnativeComponent component = new KnativeComponent();
- component.setTransport(transport);
-
- return new RuntimeValue<>(component);
+ public RuntimeValue createKnativeComponent() {
+ return new RuntimeValue<>(new KnativeComponent());
}
}
diff --git a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransport.java b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeConsumerFactory.java
similarity index 71%
rename from components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransport.java
rename to components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeConsumerFactory.java
index 40ce79402..4ac824a6a 100644
--- a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransport.java
+++ b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeConsumerFactory.java
@@ -19,23 +19,9 @@
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Processor;
-import org.apache.camel.Producer;
import org.apache.camel.Service;
-public interface KnativeTransport extends Service {
- /**
- * Create a camel {@link Producer} in place of the original endpoint for a specific protocol.
- *
- * @param endpoint the endpoint for which the producer should be created
- * @param configuration the general transport configuration
- * @param service the service definition containing information about how make reach the target service.
- * @return
- */
- Producer createProducer(
- Endpoint endpoint,
- KnativeTransportConfiguration configuration,
- KnativeEnvironment.KnativeResource service);
-
+public interface KnativeConsumerFactory extends Service {
/**
* Create a camel {@link Consumer} in place of the original endpoint for a specific protocol.
*
diff --git a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeProducerFactory.java b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeProducerFactory.java
new file mode 100644
index 000000000..fc503df78
--- /dev/null
+++ b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeProducerFactory.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.component.knative.spi;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Producer;
+import org.apache.camel.Service;
+
+public interface KnativeProducerFactory extends Service {
+ /**
+ * Create a camel {@link Producer} in place of the original endpoint for a specific protocol.
+ *
+ * @param endpoint the endpoint for which the producer should be created
+ * @param configuration the general transport configuration
+ * @param service the service definition containing information about how make reach the target service.
+ * @return
+ */
+ Producer createProducer(
+ Endpoint endpoint,
+ KnativeTransportConfiguration configuration,
+ KnativeEnvironment.KnativeResource service);
+}
diff --git a/components/camel-knative/camel-knative-http/pom.xml b/components/camel-knative/camel-knative-http/pom.xml
index 6407374c7..80ac74547 100644
--- a/components/camel-knative/camel-knative-http/pom.xml
+++ b/components/camel-knative/camel-knative-http/pom.xml
@@ -46,13 +46,14 @@
- org.apache.camel
- camel-platform-http-vertx
+ io.vertx
+ vertx-web-client
+ ${vertx-version}
io.vertx
- vertx-web-client
+ vertx-web
${vertx-version}
@@ -95,12 +96,17 @@
org.apache.camel
- camel-http
+ camel-core-languages
test
org.apache.camel
- camel-core-languages
+ camel-platform-http-vertx
+ test
+
+
+ org.apache.camel
+ camel-http
test
diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
index d29d97e76..bfc057d74 100644
--- a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
+++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
@@ -18,17 +18,21 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.Map;
import java.util.function.Predicate;
+import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.Route;
+import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
+import io.vertx.ext.web.handler.BodyHandler;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
@@ -37,7 +41,6 @@
import org.apache.camel.TypeConverter;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
-import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.support.DefaultConsumer;
import org.apache.camel.support.ExchangeHelper;
@@ -52,17 +55,19 @@ public class KnativeHttpConsumer extends DefaultConsumer {
private final KnativeTransportConfiguration configuration;
private final Predicate filter;
private final KnativeEnvironment.KnativeResource serviceDefinition;
- private final VertxPlatformHttpRouter router;
+ private final Router router;
private final HeaderFilterStrategy headerFilterStrategy;
private String basePath;
private Route route;
+ private BigInteger maxBodySize;
+ private boolean preallocateBodyBuffer;
public KnativeHttpConsumer(
KnativeTransportConfiguration configuration,
Endpoint endpoint,
KnativeEnvironment.KnativeResource serviceDefinition,
- VertxPlatformHttpRouter router,
+ Router router,
Processor processor) {
super(endpoint, processor);
@@ -72,6 +77,7 @@ public KnativeHttpConsumer(
this.router = router;
this.headerFilterStrategy = new KnativeHttpHeaderFilterStrategy();
this.filter = KnativeHttpSupport.createFilter(serviceDefinition);
+ this.preallocateBodyBuffer = true;
}
public String getBasePath() {
@@ -82,10 +88,29 @@ public void setBasePath(String basePath) {
this.basePath = basePath;
}
+ public BigInteger getMaxBodySize() {
+ return maxBodySize;
+ }
+
+ public void setMaxBodySize(BigInteger maxBodySize) {
+ this.maxBodySize = maxBodySize;
+ }
+
+ public boolean isPreallocateBodyBuffer() {
+ return preallocateBodyBuffer;
+ }
+
+ public void setPreallocateBodyBuffer(boolean preallocateBodyBuffer) {
+ this.preallocateBodyBuffer = preallocateBodyBuffer;
+ }
+
@Override
protected void doStart() throws Exception {
if (route == null) {
- String path = ObjectHelper.supplyIfEmpty(serviceDefinition.getPath(), () -> KnativeHttpTransport.DEFAULT_PATH);
+ String path = serviceDefinition.getPath();
+ if (ObjectHelper.isEmpty(path)) {
+ path = "/";
+ }
if (ObjectHelper.isNotEmpty(basePath)) {
path = basePath + path;
}
@@ -97,8 +122,20 @@ protected void doStart() throws Exception {
path
);
+ BodyHandler bodyHandler = BodyHandler.create();
+ bodyHandler.setPreallocateBodyBuffer(this.preallocateBodyBuffer);
+ if (this.maxBodySize != null) {
+ bodyHandler.setBodyLimit(this.maxBodySize.longValueExact());
+ }
+
// add body handler
- route.handler(router.bodyHandler());
+ route.handler(new Handler() {
+ @Override
+ public void handle(RoutingContext event) {
+ event.request().resume();
+ bodyHandler.handle(event);
+ }
+ });
// add knative handler
route.handler(routingContext -> {
@@ -161,7 +198,7 @@ private void handleRequest(RoutingContext routingContext) {
// from("knative:event/my.event")
// .to("http://{{env:PROJECT}}.{{env:NAMESPACE}}.svc.cluster.local/service");
//
- router.vertx().executeBlocking(
+ routingContext.vertx().executeBlocking(
promise -> {
try {
createUoW(exchange);
diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumerFactory.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumerFactory.java
new file mode 100644
index 000000000..9df388c3e
--- /dev/null
+++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumerFactory.java
@@ -0,0 +1,67 @@
+/*
+ * 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.component.knative.http;
+
+import java.util.Objects;
+
+import io.vertx.ext.web.Router;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.component.knative.spi.KnativeConsumerFactory;
+import org.apache.camel.component.knative.spi.KnativeEnvironment;
+import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
+import org.apache.camel.support.service.ServiceSupport;
+
+public class KnativeHttpConsumerFactory extends ServiceSupport implements CamelContextAware, KnativeConsumerFactory {
+ private Router router;
+ private CamelContext camelContext;
+
+ public Router getRouter() {
+ return router;
+ }
+
+ public KnativeHttpConsumerFactory setRouter(Router router) {
+ this.router = router;
+ return this;
+ }
+
+ @Override
+ public void setCamelContext(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+ @Override
+ public CamelContext getCamelContext() {
+ return camelContext;
+ }
+
+ @Override
+ public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service, Processor processor) {
+ Objects.requireNonNull(this.router, "router");
+
+ return new KnativeHttpConsumer(
+ config,
+ endpoint,
+ service,
+ this.router,
+ processor);
+ }
+
+}
diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpTransport.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpProducerFactory.java
similarity index 57%
rename from components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpTransport.java
rename to components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpProducerFactory.java
index 213f2e3a4..d4466b90e 100644
--- a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpTransport.java
+++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpProducerFactory.java
@@ -16,33 +16,31 @@
*/
package org.apache.camel.component.knative.http;
+import java.util.Objects;
+
+import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClientOptions;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
-import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
-import org.apache.camel.component.knative.spi.KnativeTransport;
+import org.apache.camel.component.knative.spi.KnativeProducerFactory;
import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
-import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter;
import org.apache.camel.support.service.ServiceSupport;
-public class KnativeHttpTransport extends ServiceSupport implements CamelContextAware, KnativeTransport {
- public static final int DEFAULT_PORT = 8080;
- public static final String DEFAULT_PATH = "/";
-
- private VertxPlatformHttpRouter router;
+public class KnativeHttpProducerFactory extends ServiceSupport implements CamelContextAware, KnativeProducerFactory {
+ private Vertx vertx;
private WebClientOptions vertxHttpClientOptions;
private CamelContext camelContext;
- public VertxPlatformHttpRouter getRouter() {
- return router;
+ public Vertx getVertx() {
+ return vertx;
}
- public void setRouter(VertxPlatformHttpRouter router) {
- this.router = router;
+ public KnativeHttpProducerFactory setVertx(Vertx vertx) {
+ this.vertx = vertx;
+ return this;
}
public WebClientOptions getClientOptions() {
@@ -63,38 +61,14 @@ public CamelContext getCamelContext() {
return camelContext;
}
- // *****************************
- //
- // Lifecycle
- //
- // *****************************
-
- @Override
- protected void doStart() throws Exception {
- if (this.router == null) {
- this.router = VertxPlatformHttpRouter.lookup(camelContext);
- }
- }
-
- @Override
- protected void doStop() throws Exception {
- // no-op
- }
-
- // *****************************
- //
- //
- //
- // *****************************
-
@Override
public Producer createProducer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service) {
- return new KnativeHttpProducer(endpoint, service, this.router.vertx(), vertxHttpClientOptions);
- }
+ Objects.requireNonNull(this.vertx, "vertx");
- @Override
- public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service, Processor processor) {
- return new KnativeHttpConsumer(config, endpoint, service, this.router, processor);
+ return new KnativeHttpProducer(
+ endpoint,
+ service,
+ this.vertx,
+ this.vertxHttpClientOptions);
}
-
}
diff --git a/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http b/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-consumer
similarity index 91%
rename from components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http
rename to components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-consumer
index cd5c08121..431636fe8 100644
--- a/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http
+++ b/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-consumer
@@ -15,4 +15,4 @@
# limitations under the License.
#
-class = org.apache.camel.component.knative.http.KnativeHttpTransport
\ No newline at end of file
+class = org.apache.camel.component.knative.http.KnativeHttpConsumerFactory
\ No newline at end of file
diff --git a/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-producer b/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-producer
new file mode 100644
index 000000000..897220cf7
--- /dev/null
+++ b/components/camel-knative/camel-knative-http/src/main/resources/META-INF/services/org/apache/camel/knative/transport/http-producer
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class = org.apache.camel.component.knative.http.KnativeHttpProducerFactory
\ No newline at end of file
diff --git a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
index b69d97aa5..3e45b8421 100644
--- a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
+++ b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
@@ -118,7 +118,8 @@ void testCreateComponent() {
context.start();
assertThat(context.getComponent("knative")).isInstanceOfSatisfying(KnativeComponent.class, c -> {
- assertThat(c.getTransport()).isInstanceOf(KnativeHttpTransport.class);
+ assertThat(c.getProducerFactory()).isInstanceOf(KnativeHttpProducerFactory.class);
+ assertThat(c.getConsumerFactory()).isInstanceOf(KnativeHttpConsumerFactory.class);
});
}
@@ -1414,51 +1415,6 @@ void testNoReplyMetaOverride(CloudEvent ce) throws Exception {
.body(is(emptyOrNullString()));
}
- @ParameterizedTest
- @EnumSource(CloudEvents.class)
- void testOrdering(CloudEvent ce) throws Exception {
- List hops = new Random()
- .ints(0, 100)
- .distinct()
- .limit(10)
- .mapToObj(i -> sourceEndpoint(
- "ep-" + i,
- Map.of(Knative.KNATIVE_FILTER_PREFIX + "MyHeader", "channel-" + i)))
- .collect(Collectors.toList());
-
- configureKnativeComponent(context, ce, hops);
-
- RouteBuilder.addRoutes(context, b -> {
- b.from("direct:start")
- .routeId("http")
- .toF("http://localhost:%d", platformHttpPort)
- .convertBodyTo(String.class);
-
- for (KnativeEnvironment.KnativeResource definition : hops) {
- b.fromF("knative:endpoint/%s", definition.getName())
- .routeId(definition.getName())
- .setBody().constant(definition.getName());
- }
- });
-
- context.start();
-
- List hopsDone = new ArrayList<>();
- for (KnativeEnvironment.KnativeResource definition : hops) {
- hopsDone.add(definition.getName());
-
- Exchange result = template.request(
- "direct:start",
- e -> {
- e.getMessage().setHeader("MyHeader", hopsDone);
- e.getMessage().setBody(definition.getName());
- }
- );
-
- assertThat(result.getMessage().getBody()).isEqualTo(definition.getName());
- }
- }
-
@ParameterizedTest
@EnumSource(CloudEvents.class)
void testHeaders(CloudEvent ce) throws Exception {
@@ -1515,7 +1471,6 @@ void testHeaders(CloudEvent ce) throws Exception {
@ParameterizedTest
@EnumSource(CloudEvents.class)
void testHeadersInReply(CloudEvent ce) throws Exception {
- final int port = AvailablePortFinder.getNextAvailable();
final KnativeHttpServer server = new KnativeHttpServer(context);
configureKnativeComponent(
@@ -1547,7 +1502,7 @@ void testHeadersInReply(CloudEvent ce) throws Exception {
server.start();
- Exchange exchange = template.request("direct:start", e -> e.getMessage().setBody(null));
+ Exchange exchange = template.request("direct:start", e -> e.getMessage().setBody("test"));
assertThat(exchange.getMessage().getHeaders()).containsEntry("CamelDummyHeader", "test");
} finally {
server.stop();
diff --git a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTestSupport.java b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTestSupport.java
index 5f47c000e..b1e4d76ee 100644
--- a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTestSupport.java
+++ b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTestSupport.java
@@ -20,12 +20,18 @@
import java.util.List;
import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
import org.apache.camel.component.knative.KnativeComponent;
import org.apache.camel.component.knative.spi.CloudEvent;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
+import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
import org.apache.camel.component.platform.http.PlatformHttpComponent;
import org.apache.camel.component.platform.http.PlatformHttpConstants;
import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpEngine;
+import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter;
import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpServer;
import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpServerConfiguration;
@@ -41,6 +47,20 @@ public static KnativeComponent configureKnativeComponent(CamelContext context, C
KnativeComponent component = context.getComponent("knative", KnativeComponent.class);
component.setCloudEventsSpecVersion(ce.version());
component.setEnvironment(new KnativeEnvironment(definitions));
+ component.setConsumerFactory(new KnativeHttpConsumerFactory() {
+ @Override
+ public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service, Processor processor) {
+ this.setRouter(VertxPlatformHttpRouter.lookup(context));
+ return super.createConsumer(endpoint, config, service, processor);
+ }
+ });
+ component.setProducerFactory(new KnativeHttpProducerFactory() {
+ @Override
+ public Producer createProducer(Endpoint endpoint, KnativeTransportConfiguration config, KnativeEnvironment.KnativeResource service) {
+ this.setVertx(VertxPlatformHttpRouter.lookup(context).vertx());
+ return super.createProducer(endpoint, config, service);
+ }
+ });
return component;
}
diff --git a/components/camel-knative/camel-knative/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java b/components/camel-knative/camel-knative/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
index b64e4821f..f3eb5a1ed 100644
--- a/components/camel-knative/camel-knative/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
+++ b/components/camel-knative/camel-knative/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
@@ -22,10 +22,11 @@ public class KnativeComponentConfigurer extends PropertyConfigurerSupport implem
map.put("cloudEventsSpecVersion", java.lang.String.class);
map.put("cloudEventsType", java.lang.String.class);
map.put("configuration", org.apache.camel.component.knative.KnativeConfiguration.class);
+ map.put("consumerFactory", org.apache.camel.component.knative.spi.KnativeConsumerFactory.class);
map.put("environment", org.apache.camel.component.knative.spi.KnativeEnvironment.class);
map.put("environmentPath", java.lang.String.class);
map.put("filters", java.util.Map.class);
- map.put("transport", org.apache.camel.component.knative.spi.KnativeTransport.class);
+ map.put("producerFactory", org.apache.camel.component.knative.spi.KnativeProducerFactory.class);
map.put("transportOptions", java.util.Map.class);
map.put("typeId", java.lang.String.class);
map.put("bridgeErrorHandler", boolean.class);
@@ -63,6 +64,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
case "cloudeventstype":
case "cloudEventsType": getOrCreateConfiguration(target).setCloudEventsType(property(camelContext, java.lang.String.class, value)); return true;
case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.knative.KnativeConfiguration.class, value)); return true;
+ case "consumerfactory":
+ case "consumerFactory": target.setConsumerFactory(property(camelContext, org.apache.camel.component.knative.spi.KnativeConsumerFactory.class, value)); return true;
case "environment": getOrCreateConfiguration(target).setEnvironment(property(camelContext, org.apache.camel.component.knative.spi.KnativeEnvironment.class, value)); return true;
case "environmentpath":
case "environmentPath": target.setEnvironmentPath(property(camelContext, java.lang.String.class, value)); return true;
@@ -71,10 +74,11 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "name": getOrCreateConfiguration(target).setName(property(camelContext, java.lang.String.class, value)); return true;
+ case "producerfactory":
+ case "producerFactory": target.setProducerFactory(property(camelContext, org.apache.camel.component.knative.spi.KnativeProducerFactory.class, value)); return true;
case "reply": getOrCreateConfiguration(target).setReply(property(camelContext, java.lang.Boolean.class, value)); return true;
case "replywithcloudevent":
case "replyWithCloudEvent": getOrCreateConfiguration(target).setReplyWithCloudEvent(property(camelContext, boolean.class, value)); return true;
- case "transport": target.setTransport(property(camelContext, org.apache.camel.component.knative.spi.KnativeTransport.class, value)); return true;
case "transportoptions":
case "transportOptions": getOrCreateConfiguration(target).setTransportOptions(property(camelContext, java.util.Map.class, value)); return true;
case "typeid":
@@ -105,6 +109,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
case "cloudeventstype":
case "cloudEventsType": return getOrCreateConfiguration(target).getCloudEventsType();
case "configuration": return target.getConfiguration();
+ case "consumerfactory":
+ case "consumerFactory": return target.getConsumerFactory();
case "environment": return getOrCreateConfiguration(target).getEnvironment();
case "environmentpath":
case "environmentPath": return target.getEnvironmentPath();
@@ -113,10 +119,11 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "name": return getOrCreateConfiguration(target).getName();
+ case "producerfactory":
+ case "producerFactory": return target.getProducerFactory();
case "reply": return getOrCreateConfiguration(target).getReply();
case "replywithcloudevent":
case "replyWithCloudEvent": return getOrCreateConfiguration(target).isReplyWithCloudEvent();
- case "transport": return target.getTransport();
case "transportoptions":
case "transportOptions": return getOrCreateConfiguration(target).getTransportOptions();
case "typeid":
diff --git a/components/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json b/components/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
index 5793530a4..f4f9ee2f5 100644
--- a/components/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
+++ b/components/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
@@ -6,7 +6,7 @@
"description": "This component allows to interact with Knative.",
"deprecated": false,
"firstVersion": "3.0.0",
- "label": "cloud,eventing",
+ "label": "cloud",
"javaType": "org.apache.camel.component.knative.KnativeComponent",
"supportLevel": "Preview",
"groupId": "org.apache.camel.k",
@@ -26,10 +26,11 @@
"cloudEventsSpecVersion": { "kind": "property", "displayName": "Cloud Events Spec Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "0.1", "0.2", "0.3", "1.0" ], "deprecated": false, "secret": false, "defaultValue": "1.0", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the version of the cloudevents spec." },
"cloudEventsType": { "kind": "property", "displayName": "Cloud Events Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "org.apache.camel.event", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the event-type information of the produced events." },
"configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.KnativeConfiguration", "deprecated": false, "secret": false, "description": "Set the configuration." },
+ "consumerFactory": { "kind": "property", "displayName": "Consumer Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeConsumerFactory", "deprecated": false, "secret": false, "description": "The protocol consumer factory." },
"environment": { "kind": "property", "displayName": "Environment", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeEnvironment", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The environment" },
"environmentPath": { "kind": "property", "displayName": "Environment Path", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The path ot the environment definition" },
"filters": { "kind": "property", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map", "prefix": "filter.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the filters." },
- "transport": { "kind": "property", "displayName": "Transport", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeTransport", "deprecated": false, "secret": false, "description": "The transport implementation." },
+ "producerFactory": { "kind": "property", "displayName": "Producer Factory", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeProducerFactory", "deprecated": false, "secret": false, "description": "The protocol producer factory." },
"transportOptions": { "kind": "property", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map", "prefix": "transport.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
"typeId": { "kind": "property", "displayName": "Type Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the service to lookup from the KnativeEnvironment." },
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
diff --git a/components/camel-knative/camel-knative/src/main/docs/knative-component.adoc b/components/camel-knative/camel-knative/src/main/docs/knative-component.adoc
index 4b0d15c7f..e395a9499 100644
--- a/components/camel-knative/camel-knative/src/main/docs/knative-component.adoc
+++ b/components/camel-knative/camel-knative/src/main/docs/knative-component.adoc
@@ -43,7 +43,7 @@ You can append query options to the URI in the following format:
== Options
// component options: START
-The Knative component supports 17 options, which are listed below.
+The Knative component supports 18 options, which are listed below.
@@ -54,11 +54,12 @@ The Knative component supports 17 options, which are listed below.
| *cloudEventsSpecVersion* (common) | Set the version of the cloudevents spec. The value can be one of: 0.1, 0.2, 0.3, 1.0 | 1.0 | String
| *cloudEventsType* (common) | Set the event-type information of the produced events. | org.apache.camel.event | String
| *configuration* (common) | Set the configuration. | | KnativeConfiguration
+| *consumerFactory* (common) | The protocol consumer factory. | | KnativeConsumerFactory
| *environment* (common) | The environment | | KnativeEnvironment
| *environmentPath* (common) | The path ot the environment definition | | String
| *filters* (common) | Set the filters. | | Map
+| *producerFactory* (common) | The protocol producer factory. | | KnativeProducerFactory
| *serviceName* (common) | The name of the service to lookup from the KnativeEnvironment. | | String
-| *transport* (common) | The transport implementation. | | KnativeTransport
| *transportOptions* (common) | Set the transport options. | | Map
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
| *replyWithCloudEvent* (consumer) | Transforms the reply into a cloud event that will be processed by the caller. When listening to events from a Knative Broker, if this flag is enabled, replies will be published to the same Broker where the request comes from (beware that if you don't change the type of the received message, you may create a loop and receive your same reply). When this flag is disabled, CloudEvent headers are removed from the reply. | false | boolean
diff --git a/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java b/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
index 337626bcd..b2c51b73d 100644
--- a/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
+++ b/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
@@ -24,8 +24,9 @@
import org.apache.camel.Endpoint;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.component.knative.spi.Knative;
+import org.apache.camel.component.knative.spi.KnativeConsumerFactory;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
-import org.apache.camel.component.knative.spi.KnativeTransport;
+import org.apache.camel.component.knative.spi.KnativeProducerFactory;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
@@ -50,9 +51,12 @@ public class KnativeComponent extends DefaultComponent {
private Knative.Protocol protocol = Knative.Protocol.http;
@Metadata
- private KnativeTransport transport;
+ private KnativeProducerFactory producerFactory;
+ @Metadata
+ private KnativeConsumerFactory consumerFactory;
- private boolean managedTransport;
+ private boolean managedProducer;
+ private boolean managedConsumer;
public KnativeComponent() {
this(null);
@@ -127,15 +131,26 @@ public KnativeComponent setProtocol(Knative.Protocol protocol) {
return this;
}
- public KnativeTransport getTransport() {
- return transport;
+ public KnativeProducerFactory getProducerFactory() {
+ return producerFactory;
+ }
+
+ /**
+ * The protocol producer factory.
+ */
+ public void setProducerFactory(KnativeProducerFactory producerFactory) {
+ this.producerFactory = producerFactory;
+ }
+
+ public KnativeConsumerFactory getConsumerFactory() {
+ return consumerFactory;
}
/**
- * The transport implementation.
+ * The protocol consumer factory.
*/
- public void setTransport(KnativeTransport transport) {
- this.transport = transport;
+ public void setConsumerFactory(KnativeConsumerFactory consumerFactory) {
+ this.consumerFactory = consumerFactory;
}
public Map getTransportOptions() {
@@ -159,41 +174,30 @@ public void setTransportOptions(Map transportOptions) {
protected void doInit() throws Exception {
super.doInit();
- if (transport == null) {
- this.transport = getCamelContext().getRegistry().lookupByNameAndType(protocol.name(), KnativeTransport.class);
-
- if (this.transport == null) {
- this.transport = getCamelContext()
- .adapt(ExtendedCamelContext.class)
- .getFactoryFinder(Knative.KNATIVE_TRANSPORT_RESOURCE_PATH)
- .newInstance(protocol.name(), KnativeTransport.class)
- .orElseThrow(() -> new RuntimeException("Error creating knative transport for protocol: " + protocol.name()));
-
- if (configuration.getTransportOptions() != null) {
- setProperties(transport, new HashMap<>(configuration.getTransportOptions()));
- }
+ setUpProducerFactory();
+ setUpConsumerFactory();
- this.managedTransport = true;
- }
+ if (this.producerFactory != null && managedProducer) {
+ ServiceHelper.initService(this.producerFactory);
}
-
- if (this.transport instanceof CamelContextAware) {
- CamelContextAware camelContextAware = (CamelContextAware)this.transport;
-
- if (camelContextAware.getCamelContext() == null) {
- camelContextAware.setCamelContext(getCamelContext());
- }
+ if (this.consumerFactory != null && managedConsumer) {
+ ServiceHelper.initService(this.consumerFactory);
}
-
- LOGGER.info("found knative transport: {} for protocol: {}", transport, protocol.name());
}
@Override
protected void doStart() throws Exception {
super.doStart();
- if (this.transport != null && managedTransport) {
- ServiceHelper.startService(this.transport);
+ if (this.producerFactory != null && managedProducer) {
+ ServiceHelper.startService(this.producerFactory);
+ }
+ if (this.consumerFactory != null && managedConsumer) {
+ ServiceHelper.startService(this.consumerFactory);
+ }
+
+ if (this.producerFactory == null && this.consumerFactory == null) {
+ throw new IllegalStateException("No prodcuer or consumer factroy have been configured");
}
}
@@ -201,8 +205,11 @@ protected void doStart() throws Exception {
protected void doStop() throws Exception {
super.doStop();
- if (this.transport != null && managedTransport) {
- ServiceHelper.stopService(this.transport);
+ if (this.producerFactory != null && managedProducer) {
+ ServiceHelper.stopService(this.producerFactory);
+ }
+ if (this.consumerFactory != null && managedConsumer) {
+ ServiceHelper.stopService(this.consumerFactory);
}
}
@@ -280,4 +287,59 @@ private KnativeConfiguration getKnativeConfiguration() throws Exception {
return conf;
}
+
+ private void setUpProducerFactory() throws Exception {
+ if (producerFactory == null) {
+ this.producerFactory = getCamelContext().getRegistry().lookupByNameAndType(protocol.name(), KnativeProducerFactory.class);
+
+ if (this.producerFactory == null) {
+ this.producerFactory = getCamelContext()
+ .adapt(ExtendedCamelContext.class)
+ .getFactoryFinder(Knative.KNATIVE_TRANSPORT_RESOURCE_PATH)
+ .newInstance(protocol.name() + "-producer", KnativeProducerFactory.class)
+ .orElse(null);
+
+ if (this.producerFactory == null) {
+ return;
+ }
+
+ if (configuration.getTransportOptions() != null) {
+ setProperties(producerFactory, new HashMap<>(configuration.getTransportOptions()));
+ }
+
+ this.managedProducer = true;
+
+ CamelContextAware.trySetCamelContext(this.producerFactory, getCamelContext());
+ }
+
+ LOGGER.info("found knative producer factory: {} for protocol: {}", producerFactory, protocol.name());
+ }
+ }
+
+ private void setUpConsumerFactory() throws Exception {
+ if (consumerFactory == null) {
+ this.consumerFactory = getCamelContext().getRegistry().lookupByNameAndType(protocol.name(), KnativeConsumerFactory.class);
+
+ if (this.consumerFactory == null) {
+ this.consumerFactory = getCamelContext()
+ .adapt(ExtendedCamelContext.class)
+ .getFactoryFinder(Knative.KNATIVE_TRANSPORT_RESOURCE_PATH)
+ .newInstance(protocol.name() + "-consumer", KnativeConsumerFactory.class)
+ .orElse(null);
+
+ if (this.producerFactory == null) {
+ return;
+ }
+ if (configuration.getTransportOptions() != null) {
+ setProperties(consumerFactory, new HashMap<>(configuration.getTransportOptions()));
+ }
+
+ this.managedConsumer = true;
+
+ CamelContextAware.trySetCamelContext(this.consumerFactory, getCamelContext());
+ }
+
+ LOGGER.info("found knative consumer factory: {} for protocol: {}", consumerFactory, protocol.name());
+ }
+ }
}
diff --git a/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
index 0b4025770..ac75eda39 100644
--- a/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
+++ b/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
@@ -23,6 +23,7 @@
import java.util.function.Predicate;
import java.util.stream.Stream;
+import org.apache.camel.Category;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
@@ -48,13 +49,14 @@
scheme = "knative",
syntax = "knative:type/typeId",
title = "Knative",
- label = "cloud,eventing")
+ category = Category.CLOUD)
public class KnativeEndpoint extends DefaultEndpoint {
+ private final CloudEventProcessor cloudEvent;
+
@UriPath(description = "The Knative resource type")
private final Knative.Type type;
@UriPath(description = "The identifier of the Knative resource")
private final String typeId;
- private final CloudEventProcessor cloudEvent;
@UriParam
private KnativeConfiguration configuration;
@@ -76,12 +78,13 @@ public KnativeComponent getComponent() {
public Producer createProducer() throws Exception {
final KnativeEnvironment.KnativeResource service = lookupServiceDefinition(Knative.EndpointKind.sink);
final Processor ceProcessor = cloudEvent.producer(this, service);
- final Producer producer = getComponent().getTransport().createProducer(this, createTransportConfiguration(service), service);
+ final Producer producer = getComponent().getProducerFactory().createProducer(this, createTransportConfiguration(service), service);
PropertyBindingSupport.build()
.withCamelContext(getCamelContext())
.withProperties(configuration.getTransportOptions())
.withRemoveParameters(false)
+ .withMandatory(false)
.withTarget(producer)
.bind();
@@ -94,12 +97,13 @@ public Consumer createConsumer(Processor processor) throws Exception {
final Processor ceProcessor = cloudEvent.consumer(this, service);
final Processor replyProcessor = configuration.isReplyWithCloudEvent() ? cloudEvent.producer(this, service) : null;
final Processor pipeline = Pipeline.newInstance(getCamelContext(), ceProcessor, processor, replyProcessor);
- final Consumer consumer = getComponent().getTransport().createConsumer(this, createTransportConfiguration(service), service, pipeline);
+ final Consumer consumer = getComponent().getConsumerFactory().createConsumer(this, createTransportConfiguration(service), service, pipeline);
PropertyBindingSupport.build()
.withCamelContext(getCamelContext())
.withProperties(configuration.getTransportOptions())
.withRemoveParameters(false)
+ .withMandatory(false)
.withTarget(consumer)
.bind();
diff --git a/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java b/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
index 5cbd7a233..00123857b 100644
--- a/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
+++ b/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
@@ -68,7 +68,8 @@ void testLoadEnvironment(String resource) throws Exception {
KnativeComponent component = new KnativeComponent();
component.setEnvironment(env);
- component.setTransport(new KnativeTransportNoop());
+ component.setConsumerFactory(new KnativeTransportNoop());
+ component.setProducerFactory(new KnativeTransportNoop());
context.getRegistry().bind("ereg", KnativeEnvironmentSupport.endpoint(Knative.EndpointKind.source, "ereg", null));
context.getRegistry().bind("creg", KnativeEnvironmentSupport.channel(Knative.EndpointKind.source, "creg", null));
diff --git a/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java b/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java
index e508a64e8..cf46f16d9 100644
--- a/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java
+++ b/components/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java
@@ -21,13 +21,14 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
+import org.apache.camel.component.knative.spi.KnativeConsumerFactory;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
-import org.apache.camel.component.knative.spi.KnativeTransport;
+import org.apache.camel.component.knative.spi.KnativeProducerFactory;
import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
import org.apache.camel.support.DefaultConsumer;
import org.apache.camel.support.DefaultProducer;
-public class KnativeTransportNoop implements KnativeTransport {
+public class KnativeTransportNoop implements KnativeConsumerFactory, KnativeProducerFactory {
@Override
public void start() {
}
diff --git a/itests/camel-k-itests-knative-consumer/pom.xml b/itests/camel-k-itests-knative-consumer/pom.xml
new file mode 100644
index 000000000..3fb74ca29
--- /dev/null
+++ b/itests/camel-k-itests-knative-consumer/pom.xml
@@ -0,0 +1,200 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-itests
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-itests-knative-consumer
+
+
+
+ org.apache.camel.k
+ camel-k-runtime
+
+
+ org.apache.camel.k
+ camel-k-knative
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
+
+
+
+ io.quarkus
+ quarkus-jsonb
+
+
+ io.quarkus
+ quarkus-resteasy
+
+
+ io.quarkus
+ quarkus-resteasy-jsonb
+
+
+
+
+ io.quarkus
+ quarkus-junit5
+ test
+
+
+ io.rest-assured
+ rest-assured
+ test
+
+
+ org.assertj
+ assertj-core
+ test
+
+
+
+
+ org.apache.camel.k
+ camel-k-runtime-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ ${build-helper-maven-plugin-version}
+
+
+ reserve-network-port
+
+ reserve-network-port
+
+ process-resources
+
+
+ test.http.port.jvm
+ test.http.port.native
+
+
+
+
+
+
+ io.quarkus
+ quarkus-maven-plugin
+ ${quarkus-version}
+
+
+
+ build
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ ${test.http.port.jvm}
+ org.jboss.logmanager.LogManager
+
+
+
+
+
+
+
+
+ native
+
+
+ native
+
+
+
+ native
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+ ${test.http.port.native}
+ ${project.build.directory}/${project.build.finalName}-runner
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itests/camel-k-itests-knative-consumer/src/main/java/org/apache/camel/k/quarkus/it/KnativeConsumerApplication.java b/itests/camel-k-itests-knative-consumer/src/main/java/org/apache/camel/k/quarkus/it/KnativeConsumerApplication.java
new file mode 100644
index 000000000..87c63ee52
--- /dev/null
+++ b/itests/camel-k-itests-knative-consumer/src/main/java/org/apache/camel/k/quarkus/it/KnativeConsumerApplication.java
@@ -0,0 +1,53 @@
+/*
+ * 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.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.knative.KnativeComponent;
+
+@Path("/test")
+@ApplicationScoped
+public class KnativeConsumerApplication {
+ @Inject
+ CamelContext context;
+
+ @GET
+ @Path("/inspect")
+ @Produces(MediaType.APPLICATION_JSON)
+ public JsonObject inspect() {
+ var component = context.getComponent("knative", KnativeComponent.class);
+ var builder = Json.createObjectBuilder();
+
+ if (component.getProducerFactory() != null) {
+ builder.add("producer-factory", component.getProducerFactory().getClass().getName());
+ }
+ if (component.getConsumerFactory() != null) {
+ builder.add("consumer-factory", component.getConsumerFactory().getClass().getName());
+ }
+
+ return builder.build();
+ }
+}
diff --git a/itests/camel-k-itests-knative-consumer/src/main/resources/application.properties b/itests/camel-k-itests-knative-consumer/src/main/resources/application.properties
new file mode 100644
index 000000000..3ce549334
--- /dev/null
+++ b/itests/camel-k-itests-knative-consumer/src/main/resources/application.properties
@@ -0,0 +1,23 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# Quarkus
+#
+quarkus.log.console.enable = false
+quarkus.banner.enabled = false
+
diff --git a/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerIT.java b/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerIT.java
new file mode 100644
index 000000000..e5725b172
--- /dev/null
+++ b/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class KnativeConsumerIT extends KnativeConsumerTest {
+}
\ No newline at end of file
diff --git a/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerTest.java b/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerTest.java
new file mode 100644
index 000000000..65372ceb4
--- /dev/null
+++ b/itests/camel-k-itests-knative-consumer/src/test/java/org/apache/camel/k/quarkus/it/KnativeConsumerTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.it;
+
+import javax.ws.rs.core.MediaType;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.path.json.JsonPath;
+import org.apache.camel.component.knative.http.KnativeHttpConsumerFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@QuarkusTest
+public class KnativeConsumerTest {
+ @Test
+ public void inspect() {
+ JsonPath p = RestAssured.given()
+ .contentType(MediaType.TEXT_PLAIN)
+ .accept(MediaType.APPLICATION_JSON)
+ .get("/test/inspect")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body()
+ .jsonPath();
+
+ assertThat(p.getString("consumer-factory"))
+ .isEqualTo(KnativeHttpConsumerFactory.class.getName());
+ assertThat(p.getString("producer-factory"))
+ .isNullOrEmpty();
+ }
+}
\ No newline at end of file
diff --git a/itests/camel-k-itests-knative-producer/pom.xml b/itests/camel-k-itests-knative-producer/pom.xml
new file mode 100644
index 000000000..1507b9079
--- /dev/null
+++ b/itests/camel-k-itests-knative-producer/pom.xml
@@ -0,0 +1,200 @@
+
+
+
+
+ org.apache.camel.k
+ camel-k-itests
+ 1.6.0-SNAPSHOT
+
+ 4.0.0
+
+ camel-k-itests-knative-producer
+
+
+
+ org.apache.camel.k
+ camel-k-runtime
+
+
+ org.apache.camel.k
+ camel-k-knative
+
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+
+
+ io.quarkus
+ quarkus-jsonb
+
+
+ io.quarkus
+ quarkus-resteasy
+
+
+ io.quarkus
+ quarkus-resteasy-jsonb
+
+
+
+
+ io.quarkus
+ quarkus-junit5
+ test
+
+
+ io.rest-assured
+ rest-assured
+ test
+
+
+ org.assertj
+ assertj-core
+ test
+
+
+
+
+ org.apache.camel.k
+ camel-k-runtime-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-producer-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ ${build-helper-maven-plugin-version}
+
+
+ reserve-network-port
+
+ reserve-network-port
+
+ process-resources
+
+
+ test.http.port.jvm
+ test.http.port.native
+
+
+
+
+
+
+ io.quarkus
+ quarkus-maven-plugin
+ ${quarkus-version}
+
+
+
+ build
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ ${test.http.port.jvm}
+ org.jboss.logmanager.LogManager
+
+
+
+
+
+
+
+
+ native
+
+
+ native
+
+
+
+ native
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+ ${test.http.port.native}
+ ${project.build.directory}/${project.build.finalName}-runner
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itests/camel-k-itests-knative-producer/src/main/java/org/apache/camel/k/quarkus/it/KnativeProducerApplication.java b/itests/camel-k-itests-knative-producer/src/main/java/org/apache/camel/k/quarkus/it/KnativeProducerApplication.java
new file mode 100644
index 000000000..32c28b343
--- /dev/null
+++ b/itests/camel-k-itests-knative-producer/src/main/java/org/apache/camel/k/quarkus/it/KnativeProducerApplication.java
@@ -0,0 +1,53 @@
+/*
+ * 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.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.knative.KnativeComponent;
+
+@Path("/test")
+@ApplicationScoped
+public class KnativeProducerApplication {
+ @Inject
+ CamelContext context;
+
+ @GET
+ @Path("/inspect")
+ @Produces(MediaType.APPLICATION_JSON)
+ public JsonObject inspect() {
+ var component = context.getComponent("knative", KnativeComponent.class);
+ var builder = Json.createObjectBuilder();
+
+ if (component.getProducerFactory() != null) {
+ builder.add("producer-factory", component.getProducerFactory().getClass().getName());
+ }
+ if (component.getConsumerFactory() != null) {
+ builder.add("consumer-factory", component.getConsumerFactory().getClass().getName());
+ }
+
+ return builder.build();
+ }
+}
diff --git a/itests/camel-k-itests-knative-producer/src/main/resources/application.properties b/itests/camel-k-itests-knative-producer/src/main/resources/application.properties
new file mode 100644
index 000000000..3ce549334
--- /dev/null
+++ b/itests/camel-k-itests-knative-producer/src/main/resources/application.properties
@@ -0,0 +1,23 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# Quarkus
+#
+quarkus.log.console.enable = false
+quarkus.banner.enabled = false
+
diff --git a/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerIT.java b/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerIT.java
new file mode 100644
index 000000000..4606c20b2
--- /dev/null
+++ b/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class KnativeProducerIT extends KnativeProducerTest {
+}
\ No newline at end of file
diff --git a/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerTest.java b/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerTest.java
new file mode 100644
index 000000000..eecc2303d
--- /dev/null
+++ b/itests/camel-k-itests-knative-producer/src/test/java/org/apache/camel/k/quarkus/it/KnativeProducerTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.it;
+
+import javax.ws.rs.core.MediaType;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.path.json.JsonPath;
+import org.apache.camel.component.knative.http.KnativeHttpProducerFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@QuarkusTest
+public class KnativeProducerTest {
+ @Test
+ public void inspect() {
+ JsonPath p = RestAssured.given()
+ .contentType(MediaType.TEXT_PLAIN)
+ .accept(MediaType.APPLICATION_JSON)
+ .get("/test/inspect")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body()
+ .jsonPath();
+
+ assertThat(p.getString("consumer-factory"))
+ .isNullOrEmpty();
+ assertThat(p.getString("producer-factory"))
+ .isEqualTo(KnativeHttpProducerFactory.class.getName());
+ }
+}
\ No newline at end of file
diff --git a/itests/camel-k-itests-knative-sinkbinding/pom.xml b/itests/camel-k-itests-knative-sinkbinding/pom.xml
index bc2846714..0a7786a9a 100644
--- a/itests/camel-k-itests-knative-sinkbinding/pom.xml
+++ b/itests/camel-k-itests-knative-sinkbinding/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-yaml
diff --git a/itests/camel-k-itests-knative-source-groovy/pom.xml b/itests/camel-k-itests-knative-source-groovy/pom.xml
index 05d7e51d8..7ab4e7f22 100644
--- a/itests/camel-k-itests-knative-source-groovy/pom.xml
+++ b/itests/camel-k-itests-knative-source-groovy/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-groovy
diff --git a/itests/camel-k-itests-knative-source-java/pom.xml b/itests/camel-k-itests-knative-source-java/pom.xml
index 7e6694e88..80efd8812 100644
--- a/itests/camel-k-itests-knative-source-java/pom.xml
+++ b/itests/camel-k-itests-knative-source-java/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-java
diff --git a/itests/camel-k-itests-knative-source-js/pom.xml b/itests/camel-k-itests-knative-source-js/pom.xml
index e60681478..3972112ec 100644
--- a/itests/camel-k-itests-knative-source-js/pom.xml
+++ b/itests/camel-k-itests-knative-source-js/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-js
diff --git a/itests/camel-k-itests-knative-source-xml/pom.xml b/itests/camel-k-itests-knative-source-xml/pom.xml
index 7756cd82c..d1a4053dd 100644
--- a/itests/camel-k-itests-knative-source-xml/pom.xml
+++ b/itests/camel-k-itests-knative-source-xml/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-xml
diff --git a/itests/camel-k-itests-knative-source-yaml/pom.xml b/itests/camel-k-itests-knative-source-yaml/pom.xml
index fca2d08f8..78ba1e729 100644
--- a/itests/camel-k-itests-knative-source-yaml/pom.xml
+++ b/itests/camel-k-itests-knative-source-yaml/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-yaml
diff --git a/itests/camel-k-itests-knative/pom.xml b/itests/camel-k-itests-knative/pom.xml
index baba53959..e4c5b469c 100644
--- a/itests/camel-k-itests-knative/pom.xml
+++ b/itests/camel-k-itests-knative/pom.xml
@@ -36,6 +36,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-loader-yaml
diff --git a/itests/camel-k-itests-knative/src/main/java/org/apache/camel/k/quarkus/it/KnativeApplication.java b/itests/camel-k-itests-knative/src/main/java/org/apache/camel/k/quarkus/it/KnativeApplication.java
index 7ee97b6c0..514103551 100644
--- a/itests/camel-k-itests-knative/src/main/java/org/apache/camel/k/quarkus/it/KnativeApplication.java
+++ b/itests/camel-k-itests-knative/src/main/java/org/apache/camel/k/quarkus/it/KnativeApplication.java
@@ -32,6 +32,7 @@
import io.quarkus.runtime.annotations.RegisterForReflection;
import org.apache.camel.CamelContext;
import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.component.knative.KnativeComponent;
import org.apache.camel.component.knative.KnativeEndpoint;
import org.apache.camel.component.knative.spi.Knative;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
@@ -61,6 +62,11 @@ public JsonObject inspect() {
return Json.createObjectBuilder()
.add("env-meta", envMeta)
+ .add("component", Json.createObjectBuilder()
+ .add("producer-factory", context.getComponent("knative", KnativeComponent.class).getProducerFactory().getClass().getName())
+ .add("consumer-factory", context.getComponent("knative", KnativeComponent.class).getConsumerFactory().getClass().getName())
+ .add("", "")
+ .build())
.build();
}
diff --git a/itests/camel-k-itests-knative/src/test/java/org/apache/camel/k/quarkus/it/KnativeTest.java b/itests/camel-k-itests-knative/src/test/java/org/apache/camel/k/quarkus/it/KnativeTest.java
index 7b8e933aa..07cbc49ac 100644
--- a/itests/camel-k-itests-knative/src/test/java/org/apache/camel/k/quarkus/it/KnativeTest.java
+++ b/itests/camel-k-itests-knative/src/test/java/org/apache/camel/k/quarkus/it/KnativeTest.java
@@ -25,6 +25,8 @@
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import org.apache.camel.Exchange;
+import org.apache.camel.component.knative.http.KnativeHttpConsumerFactory;
+import org.apache.camel.component.knative.http.KnativeHttpProducerFactory;
import org.apache.camel.component.knative.spi.CloudEvent;
import org.apache.camel.component.knative.spi.CloudEvents;
import org.apache.camel.component.knative.spi.Knative;
@@ -53,6 +55,12 @@ public void inspect() {
.containsEntry(Knative.KNATIVE_EVENT_TYPE, "camel.k.evt")
.containsEntry(Knative.SERVICE_META_PATH, "/knative")
.containsEntry("camel.endpoint.kind", "source");
+
+
+ assertThat(p.getString("component.consumer-factory"))
+ .isEqualTo(KnativeHttpConsumerFactory.class.getName());
+ assertThat(p.getString("component.producer-factory"))
+ .isEqualTo(KnativeHttpProducerFactory.class.getName());
}
@Test
diff --git a/itests/camel-k-itests-runtime-yaml/pom.xml b/itests/camel-k-itests-runtime-yaml/pom.xml
index d57b9c06d..97a0e1279 100644
--- a/itests/camel-k-itests-runtime-yaml/pom.xml
+++ b/itests/camel-k-itests-runtime-yaml/pom.xml
@@ -40,6 +40,14 @@
org.apache.camel.k
camel-k-knative
+
+ org.apache.camel.k
+ camel-k-knative-producer
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+
org.apache.camel.k
camel-k-itests-runtime-inspector
@@ -136,6 +144,32 @@
+
+ org.apache.camel.k
+ camel-k-knative-producer-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer-deployment
+ ${project.version}
+ pom
+ test
+
+
+ *
+ *
+
+
+
diff --git a/itests/camel-k-itests-runtime-yaml/src/main/resources/application.properties b/itests/camel-k-itests-runtime-yaml/src/main/resources/application.properties
index db0d5c9eb..0d67e0636 100644
--- a/itests/camel-k-itests-runtime-yaml/src/main/resources/application.properties
+++ b/itests/camel-k-itests-runtime-yaml/src/main/resources/application.properties
@@ -18,5 +18,5 @@
#
# Quarkus
#
-quarkus.log.console.enable = true
+quarkus.log.console.enable = false
quarkus.banner.enabled = false
diff --git a/itests/pom.xml b/itests/pom.xml
index 0b43e33d4..2b7d1ad14 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -46,6 +46,8 @@
camel-k-itests-cron
camel-k-itests-master
camel-k-itests-knative
+ camel-k-itests-knative-producer
+ camel-k-itests-knative-consumer
camel-k-itests-knative-sinkbinding
camel-k-itests-knative-source-groovy
camel-k-itests-knative-source-java
diff --git a/pom.xml b/pom.xml
index e3486e82d..51a0a7c24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -473,6 +473,26 @@
camel-k-knative-deployment
${project.version}
+
+ org.apache.camel.k
+ camel-k-knative-producer
+ ${project.version}
+
+
+ org.apache.camel.k
+ camel-k-knative-producer-deployment
+ ${project.version}
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+ ${project.version}
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer-deployment
+ ${project.version}
+
org.apache.camel.k
camel-k-cron-impl
diff --git a/support/camel-k-runtime-bom/pom.xml b/support/camel-k-runtime-bom/pom.xml
index c6c26dc38..f174dd0b2 100644
--- a/support/camel-k-runtime-bom/pom.xml
+++ b/support/camel-k-runtime-bom/pom.xml
@@ -160,6 +160,16 @@
camel-k-knative
${project.version}
+
+ org.apache.camel.k
+ camel-k-knative-producer
+ ${project.version}
+
+
+ org.apache.camel.k
+ camel-k-knative-consumer
+ ${project.version}
+
org.apache.camel.k
camel-k-cron-impl