You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/24 15:13:47 UTC

[camel-quarkus] branch master updated (ab5e2c8 -> f5243c6)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from ab5e2c8  chore(build): set groovy-maven-plugin version
     new 3f48af6  Fix #322 Make camel-attachments an optional dependency of platform-http
     new 228bec7  Fix #324 Document the platform-http extension
     new eb4cdfb  Make since versions of new extensions to be 0.3.0
     new f5243c6  Add more platform-http tests

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ROOT/pages/extensions/microprofile-health.adoc |  2 +-
 .../pages/extensions/microprofile-metrics.adoc     |  2 +-
 .../modules/ROOT/pages/extensions/opentracing.adoc |  2 +-
 .../ROOT/pages/extensions/platform-http.adoc       | 99 ++++++++++++++++++++++
 .../pages/list-of-camel-quarkus-extensions.adoc    | 10 +--
 .../deployment/AttachmentsProcessor.java           | 19 +++++
 .../attachments/AttachmentsRecorder.java}          | 39 ++++-----
 .../attachments}/CamelFileDataSource.java          |  2 +-
 .../quarkus/core/deployment/BuildProcessor.java    | 25 ++++++
 ...BuildItem.java => UploadAttacherBuildItem.java} | 22 +++--
 .../quarkus/core/CoreAttachmentsRecorder.java      | 42 +++++++++
 .../java/org/apache/camel/quarkus/core/Flags.java  |  1 +
 .../core/{Flags.java => UploadAttacher.java}       | 27 +++---
 extensions/microprofile-health/runtime/pom.xml     |  2 +-
 extensions/opentracing/runtime/pom.xml             |  2 +-
 extensions/platform-http/deployment/pom.xml        |  4 -
 .../http/deployment/PlatformHttpProcessor.java     |  7 +-
 extensions/platform-http/runtime/pom.xml           |  6 +-
 .../http/runtime/PlatformHttpRecorder.java         |  8 +-
 .../http/runtime/QuarkusPlatformHttpConsumer.java  | 55 ++++++------
 .../http/runtime/QuarkusPlatformHttpEngine.java    |  7 +-
 extensions/reactive-executor/runtime/pom.xml       |  2 +-
 extensions/readme.adoc                             | 10 +--
 extensions/tarfile/runtime/pom.xml                 |  2 +-
 integration-tests/platform-http/pom.xml            |  5 ++
 .../platform/http/it/PlatformHttpRouteBuilder.java | 31 +++++++
 .../http/it/TestHeaderFilterStrategy.java}         | 17 ++--
 .../component/http/server/it/PlatformHttpTest.java | 71 +++++++++++++++-
 28 files changed, 417 insertions(+), 104 deletions(-)
 create mode 100644 docs/modules/ROOT/pages/extensions/platform-http.adoc
 copy extensions/{microprofile-health/runtime/src/main/java/org/apache/camel/quarkus/component/microprofile/health/runtime/CamelMicroProfileHealthRecorder.java => attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/AttachmentsRecorder.java} (51%)
 rename extensions/{platform-http/component/src/main/java/org/apache/camel/component/platform/http => attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments}/CamelFileDataSource.java (97%)
 copy extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/{CamelReactiveExecutorBuildItem.java => UploadAttacherBuildItem.java} (59%)
 create mode 100644 extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CoreAttachmentsRecorder.java
 copy extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/{Flags.java => UploadAttacher.java} (59%)
 copy integration-tests/{platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java => platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/TestHeaderFilterStrategy.java} (69%)


[camel-quarkus] 03/04: Make since versions of new extensions to be 0.3.0

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit eb4cdfb9f0d869e19397d062571a90d76f2fbe21
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Oct 23 12:30:25 2019 +0200

    Make since versions of new extensions to be 0.3.0
---
 docs/modules/ROOT/pages/extensions/microprofile-health.adoc   |  2 +-
 docs/modules/ROOT/pages/extensions/microprofile-metrics.adoc  |  2 +-
 docs/modules/ROOT/pages/extensions/opentracing.adoc           |  2 +-
 docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc | 10 +++++-----
 extensions/microprofile-health/runtime/pom.xml                |  2 +-
 extensions/opentracing/runtime/pom.xml                        |  2 +-
 extensions/platform-http/runtime/pom.xml                      |  2 +-
 extensions/reactive-executor/runtime/pom.xml                  |  2 +-
 extensions/readme.adoc                                        | 10 +++++-----
 extensions/tarfile/runtime/pom.xml                            |  2 +-
 10 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/docs/modules/ROOT/pages/extensions/microprofile-health.adoc b/docs/modules/ROOT/pages/extensions/microprofile-health.adoc
index 111486b..477660e 100644
--- a/docs/modules/ROOT/pages/extensions/microprofile-health.adoc
+++ b/docs/modules/ROOT/pages/extensions/microprofile-health.adoc
@@ -1,7 +1,7 @@
 [[microprofile-health]]
 = MicroProfile Health Extension
 
-*Available as of Camel Quarkus version 0.21*
+*Since Camel Quarkus 0.3.0*
 
 The MicroProfile Health extension bridges the Camel health check API with MicroProfile Metrics & SmallRye Health.
 
diff --git a/docs/modules/ROOT/pages/extensions/microprofile-metrics.adoc b/docs/modules/ROOT/pages/extensions/microprofile-metrics.adoc
index 4969915..b4c4b24 100644
--- a/docs/modules/ROOT/pages/extensions/microprofile-metrics.adoc
+++ b/docs/modules/ROOT/pages/extensions/microprofile-metrics.adoc
@@ -1,7 +1,7 @@
 [[microprofile-metrics]]
 = MicroProfile Metrics Extension
 
-*Available as of Camel Quarkus version 0.21*
+*Since Camel Quarkus 0.2.0*
 
 The MicroProfile Metrics extension produces metrics and statistics related to the Camel Context, routes and message exchanges.
 
diff --git a/docs/modules/ROOT/pages/extensions/opentracing.adoc b/docs/modules/ROOT/pages/extensions/opentracing.adoc
index c925e17..09def71 100644
--- a/docs/modules/ROOT/pages/extensions/opentracing.adoc
+++ b/docs/modules/ROOT/pages/extensions/opentracing.adoc
@@ -1,7 +1,7 @@
 [[opentracing]]
 = OpenTracing Extension
 
-*Available as of Camel Quarkus version 0.21*
+*Since Camel Quarkus 0.3.0*
 
 The OpenTracing extension is used for tracing and timing incoming and outgoing Camel messages.
 
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 3f247bf..444584e 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -94,7 +94,7 @@ Number of Camel data formats: 4 in 4 JAR artifacts (0 deprecated)
 
 | link:https://camel.apache.org/components/latest/mime-multipart-dataformat.html[MIME Multipart] (camel-quarkus-mail) | 0.2 | The MIME Multipart data format is used for marshalling Camel messages with attachments into MIME-Multipart message, and vise-versa.
 
-| link:https://camel.apache.org/components/latest/tarfile-dataformat.html[Tar File] (camel-quarkus-tarfile) | 0.2.1 | The Tar File data format is a message compression and de-compression format of tar files.
+| link:https://camel.apache.org/components/latest/tarfile-dataformat.html[Tar File] (camel-quarkus-tarfile) | 0.3 | The Tar File data format is a message compression and de-compression format of tar files.
 
 | link:https://camel.apache.org/components/latest/zipfile-dataformat.html[Zip File] (camel-quarkus-zipfile) | 0.2 | The Zip File data format is a message compression and de-compression format of zip files.
 |===
@@ -140,14 +140,14 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
-| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
+| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.3 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
-| (camel-quarkus-reactive-executor) | 0.2.1 | To use Quarkus reactive executor with Camel
+| (camel-quarkus-reactive-executor) | 0.3 | To use Quarkus reactive executor with Camel
 
 | (camel-quarkus-core-xml) | 0.2 | Maven plugins configuration
 
-| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.2.1 | Integration with the Quarkus MicroProfile Health extension
+| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Integration with the Quarkus MicroProfile Health extension
 
-| xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.2.1 | Distributed tracing using OpenTracing
+| xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.3 | Distributed tracing using OpenTracing
 |===
 // others: END
diff --git a/extensions/microprofile-health/runtime/pom.xml b/extensions/microprofile-health/runtime/pom.xml
index 52080b9..e5a1fb7 100644
--- a/extensions/microprofile-health/runtime/pom.xml
+++ b/extensions/microprofile-health/runtime/pom.xml
@@ -31,7 +31,7 @@
     <description>Integration with the Quarkus MicroProfile Health extension</description>
 
     <properties>
-        <firstVersion>0.2.1</firstVersion>
+        <firstVersion>0.3.0</firstVersion>
     </properties>
 
     <dependencyManagement>
diff --git a/extensions/opentracing/runtime/pom.xml b/extensions/opentracing/runtime/pom.xml
index 2a72d64..77618b5 100644
--- a/extensions/opentracing/runtime/pom.xml
+++ b/extensions/opentracing/runtime/pom.xml
@@ -31,7 +31,7 @@
     <description>Distributed tracing using OpenTracing</description>
 
     <properties>
-        <firstVersion>0.2.1</firstVersion>
+        <firstVersion>0.3.0</firstVersion>
     </properties>
 
     <dependencyManagement>
diff --git a/extensions/platform-http/runtime/pom.xml b/extensions/platform-http/runtime/pom.xml
index f8d74b0..c6379fa 100644
--- a/extensions/platform-http/runtime/pom.xml
+++ b/extensions/platform-http/runtime/pom.xml
@@ -34,7 +34,7 @@
 
     <properties>
         <title>Camel Quarkus Platform HTTP</title>
-        <firstVersion>0.2.1</firstVersion>
+        <firstVersion>0.3.0</firstVersion>
         <label>core,http</label>
     </properties>
 
diff --git a/extensions/reactive-executor/runtime/pom.xml b/extensions/reactive-executor/runtime/pom.xml
index 0a1ea5d..971844e 100644
--- a/extensions/reactive-executor/runtime/pom.xml
+++ b/extensions/reactive-executor/runtime/pom.xml
@@ -32,7 +32,7 @@
 
     <properties>
         <title>Camel Quarkus Reactive Executor</title>
-        <firstVersion>0.2.1</firstVersion>
+        <firstVersion>0.3.0</firstVersion>
         <label>core</label>
     </properties>
 
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 27c3d2d..92bce7a 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -94,7 +94,7 @@ Number of Camel data formats: 4 in 4 JAR artifacts (0 deprecated)
 
 | link:https://camel.apache.org/components/latest/mime-multipart-dataformat.html[MIME Multipart] (camel-quarkus-mail) | 0.2 | The MIME Multipart data format is used for marshalling Camel messages with attachments into MIME-Multipart message, and vise-versa.
 
-| link:https://camel.apache.org/components/latest/tarfile-dataformat.html[Tar File] (camel-quarkus-tarfile) | 0.2.1 | The Tar File data format is a message compression and de-compression format of tar files.
+| link:https://camel.apache.org/components/latest/tarfile-dataformat.html[Tar File] (camel-quarkus-tarfile) | 0.3 | The Tar File data format is a message compression and de-compression format of tar files.
 
 | link:https://camel.apache.org/components/latest/zipfile-dataformat.html[Zip File] (camel-quarkus-zipfile) | 0.2 | The Zip File data format is a message compression and de-compression format of zip files.
 |===
@@ -142,15 +142,15 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
-| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
+| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.3 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
-| (camel-quarkus-reactive-executor) | 0.2.1 | To use Quarkus reactive executor with Camel
+| (camel-quarkus-reactive-executor) | 0.3 | To use Quarkus reactive executor with Camel
 
 | (camel-quarkus-core-xml) | 0.2 | Maven plugins configuration
 
-| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.2.1 | Integration with the Quarkus MicroProfile Health extension
+| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Integration with the Quarkus MicroProfile Health extension
 
-| xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.2.1 | Distributed tracing using OpenTracing
+| xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.3 | Distributed tracing using OpenTracing
 |===
 // others: END
 
diff --git a/extensions/tarfile/runtime/pom.xml b/extensions/tarfile/runtime/pom.xml
index f54b9e9..37f4a9a 100644
--- a/extensions/tarfile/runtime/pom.xml
+++ b/extensions/tarfile/runtime/pom.xml
@@ -30,7 +30,7 @@
     <name>Camel Quarkus :: TarFile :: Runtime</name>
 
     <properties>
-        <firstVersion>0.2.1</firstVersion>
+        <firstVersion>0.3.0</firstVersion>
     </properties>
 
     <dependencyManagement>


[camel-quarkus] 01/04: Fix #322 Make camel-attachments an optional dependency of platform-http

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 3f48af64dec23b7649c94ba03204c8bbfbdfe679
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Oct 23 10:58:04 2019 +0200

    Fix #322 Make camel-attachments an optional dependency of platform-http
---
 .../deployment/AttachmentsProcessor.java           | 19 ++++++++
 .../attachments/AttachmentsRecorder.java}          | 33 +++++++------
 .../attachments}/CamelFileDataSource.java          |  2 +-
 .../quarkus/core/deployment/BuildProcessor.java    | 25 ++++++++++
 .../core/deployment/UploadAttacherBuildItem.java   | 47 +++++++++++++++++++
 .../quarkus/core/CoreAttachmentsRecorder.java      | 42 +++++++++++++++++
 .../java/org/apache/camel/quarkus/core/Flags.java  |  1 +
 .../core/{Flags.java => UploadAttacher.java}       | 27 ++++++-----
 extensions/platform-http/deployment/pom.xml        |  4 --
 .../http/deployment/PlatformHttpProcessor.java     |  7 ++-
 extensions/platform-http/runtime/pom.xml           |  4 --
 .../http/runtime/PlatformHttpRecorder.java         |  8 +++-
 .../http/runtime/QuarkusPlatformHttpConsumer.java  | 54 ++++++++++------------
 .../http/runtime/QuarkusPlatformHttpEngine.java    |  7 ++-
 integration-tests/platform-http/pom.xml            |  4 ++
 15 files changed, 214 insertions(+), 70 deletions(-)

diff --git a/extensions/attachments/deployment/src/main/java/org/apache/camel/quarkus/component/attachments/deployment/AttachmentsProcessor.java b/extensions/attachments/deployment/src/main/java/org/apache/camel/quarkus/component/attachments/deployment/AttachmentsProcessor.java
index e679dbc..6e1ce60 100644
--- a/extensions/attachments/deployment/src/main/java/org/apache/camel/quarkus/component/attachments/deployment/AttachmentsProcessor.java
+++ b/extensions/attachments/deployment/src/main/java/org/apache/camel/quarkus/component/attachments/deployment/AttachmentsProcessor.java
@@ -16,7 +16,13 @@
  */
 package org.apache.camel.quarkus.component.attachments.deployment;
 
+import org.apache.camel.quarkus.component.attachments.AttachmentsRecorder;
+import org.apache.camel.quarkus.core.UploadAttacher;
+import org.apache.camel.quarkus.core.deployment.UploadAttacherBuildItem;
+
 import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
 
 class AttachmentsProcessor {
@@ -28,4 +34,17 @@ class AttachmentsProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
+    /**
+     * Produces the "real" {@link UploadAttacher} thus overriding the default no-op one produced by
+     * {@code camel-quarkus-core-deployment}.
+     *
+     * @param recorder the {@link AttachmentsRecorder}
+     * @return a new {@link UploadAttacherBuildItem}
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep
+    UploadAttacherBuildItem uploadAttacher(AttachmentsRecorder recorder) {
+        return new UploadAttacherBuildItem(recorder.creatUploadAttacher());
+    }
+
 }
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java b/extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/AttachmentsRecorder.java
similarity index 51%
copy from extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
copy to extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/AttachmentsRecorder.java
index a3bf6b7..8485755 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
+++ b/extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/AttachmentsRecorder.java
@@ -14,28 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.platform.http.runtime;
+package org.apache.camel.quarkus.component.attachments;
 
-import java.util.List;
+import java.io.File;
+
+import javax.activation.DataHandler;
+
+import org.apache.camel.Message;
+import org.apache.camel.attachment.AttachmentMessage;
+import org.apache.camel.quarkus.core.UploadAttacher;
+import org.jboss.logging.Logger;
 
 import io.quarkus.runtime.RuntimeValue;
 import io.quarkus.runtime.annotations.Recorder;
-import io.vertx.core.Handler;
-import io.vertx.ext.web.Router;
-import io.vertx.ext.web.RoutingContext;
-import org.apache.camel.component.platform.http.PlatformHttpComponent;
-import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
 
 @Recorder
-public class PlatformHttpRecorder {
-    public RuntimeValue<PlatformHttpEngine> createEngine(RuntimeValue<Router> router, List<Handler<RoutingContext>> handlers) {
-        return new RuntimeValue<>(new QuarkusPlatformHttpEngine(router.getValue(), handlers));
-    }
+public class AttachmentsRecorder {
 
-    public RuntimeValue<PlatformHttpComponent> createComponent(RuntimeValue<PlatformHttpEngine> engine) {
-        PlatformHttpComponent component = new PlatformHttpComponent();
-        component.setEngine(engine.getValue());
+    private static final Logger LOG = Logger.getLogger(AttachmentMessage.class);
 
-        return new RuntimeValue<>(component);
+    public RuntimeValue<UploadAttacher> creatUploadAttacher() {
+        return new RuntimeValue<>((File localFile, String fileName, Message message) -> {
+            LOG.tracef("Attaching file %s to message %s", fileName, message);
+            final AttachmentMessage am = message.getExchange().getMessage(AttachmentMessage.class);
+            am.addAttachment(fileName, new DataHandler(new CamelFileDataSource(localFile, fileName)));
+        });
     }
+
 }
diff --git a/extensions/platform-http/component/src/main/java/org/apache/camel/component/platform/http/CamelFileDataSource.java b/extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/CamelFileDataSource.java
similarity index 97%
rename from extensions/platform-http/component/src/main/java/org/apache/camel/component/platform/http/CamelFileDataSource.java
rename to extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/CamelFileDataSource.java
index b90d26c..b2fbd10 100644
--- a/extensions/platform-http/component/src/main/java/org/apache/camel/component/platform/http/CamelFileDataSource.java
+++ b/extensions/attachments/runtime/src/main/java/org/apache/camel/quarkus/component/attachments/CamelFileDataSource.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.platform.http;
+package org.apache.camel.quarkus.component.attachments;
 
 import java.io.File;
 import javax.activation.FileDataSource;
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index 33975db..9280764 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -35,6 +35,7 @@ import io.quarkus.deployment.recording.RecorderContext;
 import io.quarkus.runtime.RuntimeValue;
 import org.apache.camel.CamelContext;
 import org.apache.camel.RoutesBuilder;
+import org.apache.camel.quarkus.core.CoreAttachmentsRecorder;
 import org.apache.camel.quarkus.core.CamelConfig;
 import org.apache.camel.quarkus.core.CamelMain;
 import org.apache.camel.quarkus.core.CamelMainProducers;
@@ -42,6 +43,7 @@ import org.apache.camel.quarkus.core.CamelMainRecorder;
 import org.apache.camel.quarkus.core.CamelProducers;
 import org.apache.camel.quarkus.core.CamelRecorder;
 import org.apache.camel.quarkus.core.Flags;
+import org.apache.camel.quarkus.core.UploadAttacher;
 import org.apache.camel.spi.Registry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -275,4 +277,27 @@ class BuildProcessor {
             recorder.start(shutdown, main.getInstance());
         }
     }
+
+    /**
+     * Build steps related to Camel Attachments.
+     */
+    public static class Attachments {
+
+        /**
+         * Produces an {@link UploadAttacherBuildItem} holding a no-op {@link UploadAttacher}.
+         * <p>
+         * Note that this {@link BuildStep} is effective only if {@code camel-quarkus-attachments} extension is not in
+         * the class path.
+         *
+         * @param recorder the {@link CoreAttachmentsRecorder}
+         * @return a new {@link UploadAttacherBuildItem}
+         */
+        @Overridable
+        @Record(value = ExecutionTime.STATIC_INIT, optional = true)
+        @BuildStep
+        UploadAttacherBuildItem uploadAttacher(CoreAttachmentsRecorder recorder) {
+            return new UploadAttacherBuildItem(recorder.createNoOpUploadAttacher());
+        }
+
+    }
 }
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/UploadAttacherBuildItem.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/UploadAttacherBuildItem.java
new file mode 100644
index 0000000..b0944a5
--- /dev/null
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/UploadAttacherBuildItem.java
@@ -0,0 +1,47 @@
+/*
+ * 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.quarkus.core.deployment;
+
+import org.apache.camel.quarkus.core.UploadAttacher;
+
+import io.quarkus.builder.item.SimpleBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+
+/**
+ * Holds the {@link UploadAttacher} {@link RuntimeValue}.
+ * <p>
+ * There are two producers for this item:
+ * <ul>
+ * <li>The default one producing a no-op {@link UploadAttacher}
+ * <li>
+ * <li>The "real" one available in {@code camel-quarkus-attachments}
+ * extension</li>
+ * <ul>
+ * The "real" one is used only if the {@code camel-quarkus-attachments}
+ * extension is present in the class path.
+ */
+public final class UploadAttacherBuildItem extends SimpleBuildItem {
+    private final RuntimeValue<UploadAttacher> instance;
+
+    public UploadAttacherBuildItem(RuntimeValue<UploadAttacher> instance) {
+        this.instance = instance;
+    }
+
+    public RuntimeValue<UploadAttacher> getInstance() {
+        return instance;
+    }
+}
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CoreAttachmentsRecorder.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CoreAttachmentsRecorder.java
new file mode 100644
index 0000000..26fecd0
--- /dev/null
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CoreAttachmentsRecorder.java
@@ -0,0 +1,42 @@
+/*
+ * 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.quarkus.core;
+
+import java.io.File;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+
+import org.apache.camel.Message;
+
+@Recorder
+public class CoreAttachmentsRecorder {
+
+    public RuntimeValue<UploadAttacher> createNoOpUploadAttacher() {
+        return new RuntimeValue<>((File localFile, String fileName, Message message) -> {
+            throw new RuntimeException(
+                String.format(
+                    "File %s will not be attached to message %s because camel-quarkus-attachments is not in the class path."
+                        + " You have several options to handle this situation:"
+                        + " (a) Add camel-quarkus-attachments dependency to your project if you want Camel to attach the uploads to Camel messages"
+                        + " (b) Disable the uploads altogether by setting quarkus.http.body.handle-file-uploads = false in your application.proprties"
+                        + " (c) Ignore this message because it is perhaps caused by clients out of your control",
+                    fileName,
+                    message));
+        });
+    }
+}
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
index 6e08969..e4d13c6 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
@@ -30,4 +30,5 @@ public final class Flags {
             return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.enable-main", Boolean.class).orElse(Boolean.TRUE);
         }
     }
+
 }
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/UploadAttacher.java
similarity index 59%
copy from extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
copy to extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/UploadAttacher.java
index 6e08969..98c2663 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/UploadAttacher.java
@@ -16,18 +16,23 @@
  */
 package org.apache.camel.quarkus.core;
 
-import java.util.function.BooleanSupplier;
+import java.io.File;
 
-import org.eclipse.microprofile.config.ConfigProvider;
+import org.apache.camel.Message;
 
-public final class Flags {
-    private Flags() {
-    }
+/**
+ * Attaches file uploads to Camel {@link Message}s.
+ */
+public interface UploadAttacher {
+
+    /**
+     * Attach the uploaded file represented by the given {@code localFile} and {@code fileName} to the given
+     * {@code message}
+     *
+     * @param localFile the uploaded file stored locally
+     * @param fileName the name of the upload as sent by the client
+     * @param message the {@link Message} to attach the upload to
+     */
+    void attachUpload(File localFile, String fileName, Message message);
 
-    public static final class MainEnabled implements BooleanSupplier {
-        @Override
-        public boolean getAsBoolean() {
-            return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.enable-main", Boolean.class).orElse(Boolean.TRUE);
-        }
-    }
 }
diff --git a/extensions/platform-http/deployment/pom.xml b/extensions/platform-http/deployment/pom.xml
index 35747a8..3e17778 100644
--- a/extensions/platform-http/deployment/pom.xml
+++ b/extensions/platform-http/deployment/pom.xml
@@ -50,10 +50,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-attachments-deployment</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-platform-http</artifactId>
         </dependency>
 
diff --git a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
index 32ebe11..955a013 100644
--- a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
+++ b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
@@ -33,6 +33,8 @@ import org.apache.camel.quarkus.component.platform.http.runtime.PlatformHttpHand
 import org.apache.camel.quarkus.component.platform.http.runtime.PlatformHttpRecorder;
 import org.apache.camel.quarkus.component.platform.http.runtime.QuarkusPlatformHttpEngine;
 import org.apache.camel.quarkus.core.deployment.CamelRuntimeBeanBuildItem;
+import org.apache.camel.quarkus.core.deployment.UploadAttacherBuildItem;
+
 
 class PlatformHttpProcessor {
 
@@ -49,7 +51,8 @@ class PlatformHttpProcessor {
             PlatformHttpRecorder recorder,
             VertxWebRouterBuildItem router,
             BodyHandlerBuildItem bodyHandler,
-            List<FeatureBuildItem> features) {
+            List<FeatureBuildItem> features,
+            UploadAttacherBuildItem uploadAttacher) {
 
         List<Handler<RoutingContext>> handlers = new ArrayList<>();
 
@@ -68,7 +71,7 @@ class PlatformHttpProcessor {
         handlers.add(bodyHandler.getHandler());
 
         return new PlatformHttpEngineBuildItem(
-            recorder.createEngine(router.getRouter(), handlers)
+            recorder.createEngine(router.getRouter(), handlers, uploadAttacher.getInstance())
         );
     }
 
diff --git a/extensions/platform-http/runtime/pom.xml b/extensions/platform-http/runtime/pom.xml
index 30f7e93..f8d74b0 100644
--- a/extensions/platform-http/runtime/pom.xml
+++ b/extensions/platform-http/runtime/pom.xml
@@ -57,10 +57,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-attachments</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-platform-http-component</artifactId>
         </dependency>
 
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
index a3bf6b7..8e86b74 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
@@ -25,11 +25,15 @@ import io.vertx.ext.web.Router;
 import io.vertx.ext.web.RoutingContext;
 import org.apache.camel.component.platform.http.PlatformHttpComponent;
 import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
+import org.apache.camel.quarkus.core.UploadAttacher;
 
 @Recorder
 public class PlatformHttpRecorder {
-    public RuntimeValue<PlatformHttpEngine> createEngine(RuntimeValue<Router> router, List<Handler<RoutingContext>> handlers) {
-        return new RuntimeValue<>(new QuarkusPlatformHttpEngine(router.getValue(), handlers));
+    public RuntimeValue<PlatformHttpEngine> createEngine(
+        RuntimeValue<Router> router,
+        List<Handler<RoutingContext>> handlers,
+        RuntimeValue<UploadAttacher> uploadAttacher) {
+        return new RuntimeValue<>(new QuarkusPlatformHttpEngine(router.getValue(), handlers, uploadAttacher.getValue()));
     }
 
     public RuntimeValue<PlatformHttpComponent> createComponent(RuntimeValue<PlatformHttpEngine> engine) {
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
index 1970aa6..a852ec1 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
@@ -31,8 +31,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-import javax.activation.DataHandler;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -40,11 +38,10 @@ import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Processor;
 import org.apache.camel.TypeConversionException;
 import org.apache.camel.TypeConverter;
-import org.apache.camel.attachment.AttachmentMessage;
-import org.apache.camel.component.platform.http.CamelFileDataSource;
 import org.apache.camel.component.platform.http.PlatformHttpComponent;
 import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 import org.apache.camel.component.platform.http.spi.Method;
+import org.apache.camel.quarkus.core.UploadAttacher;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.support.DefaultConsumer;
 import org.apache.camel.support.DefaultMessage;
@@ -75,14 +72,15 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
     private final List<Handler<RoutingContext>> handlers;
     private Route route;
     private final String fileNameExtWhitelist;
+    private final UploadAttacher uploadAttacher;
 
-
-    public QuarkusPlatformHttpConsumer(PlatformHttpEndpoint endpoint, Processor processor, Router router, List<Handler<RoutingContext>> handlers) {
+    public QuarkusPlatformHttpConsumer(PlatformHttpEndpoint endpoint, Processor processor, Router router, List<Handler<RoutingContext>> handlers, UploadAttacher uploadAttacher) {
         super(endpoint, processor);
         this.router = router;
         this.handlers = handlers;
         String list = endpoint.getFileNameExtWhitelist();
         this.fileNameExtWhitelist = list == null ? list : list.toLowerCase(Locale.US);
+        this.uploadAttacher = uploadAttacher;
     }
 
     @Override
@@ -107,11 +105,9 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
         newRoute.handler(
             ctx -> {
                 try {
-                    final PlatformHttpEndpoint endpoint = getEndpoint();
-                    final HeaderFilterStrategy headerFilterStrategy = endpoint.getHeaderFilterStrategy();
-                    final Exchange e = toExchange(ctx, endpoint.createExchange(), headerFilterStrategy, fileNameExtWhitelist);
+                    final Exchange e = toExchange(ctx);
                     getProcessor().process(e);
-                    writeResponse(ctx, e, headerFilterStrategy);
+                    writeResponse(ctx, e, getEndpoint().getHeaderFilterStrategy());
                 } catch (Exception e) {
                     LOG.debugf(e, "Could not handle '%s'", path);
                     ctx.fail(e);
@@ -158,7 +154,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
 
         final TypeConverter tc = exchange.getContext().getTypeConverter();
 
-        //copy headers from Message to Response
+        // copy headers from Message to Response
         if (headerFilterStrategy != null) {
             for (Map.Entry<String, Object> entry : message.getHeaders().entrySet()) {
                 final String key = entry.getKey();
@@ -234,7 +230,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
             final byte[] bytes = new byte[4096];
             try (InputStream in = (InputStream) body) {
                 int len;
-                while ((len = in.read(bytes))  >= 0) {
+                while ((len = in.read(bytes)) >= 0) {
                     final Buffer b = Buffer.buffer(len);
                     b.appendBytes(bytes, 0, len);
                     response.write(b);
@@ -257,8 +253,9 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
 
     }
 
-    static Exchange toExchange(RoutingContext ctx, Exchange exchange, HeaderFilterStrategy headerFilterStrategy, String fileNameExtWhitelist) {
-        Message in = toCamelMessage(ctx, exchange, headerFilterStrategy, fileNameExtWhitelist);
+    Exchange toExchange(RoutingContext ctx) {
+        final Exchange exchange = getEndpoint().createExchange();
+        Message in = toCamelMessage(ctx, exchange);
 
         final String charset = ctx.parsedHeaders().contentType().parameter("charset");
         if (charset != null) {
@@ -270,8 +267,11 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
         return exchange;
     }
 
-    static void populateCamelHeaders(RoutingContext ctx, Map<String, Object> headersMap, Exchange exchange,
-            HeaderFilterStrategy headerFilterStrategy) {
+    static void populateCamelHeaders(
+        RoutingContext ctx,
+        Map<String, Object> headersMap,
+        Exchange exchange,
+        HeaderFilterStrategy headerFilterStrategy) {
 
         final HttpServerRequest request = ctx.request();
         headersMap.put(Exchange.HTTP_PATH, request.path());
@@ -330,10 +330,11 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
         headersMap.put(Exchange.HTTP_RAW_QUERY, request.query());
     }
 
-    static Message toCamelMessage(RoutingContext ctx, Exchange exchange, HeaderFilterStrategy headerFilterStrategy, String fileNameExtWhitelist) {
-        Message result = new DefaultMessage(exchange);
+    Message toCamelMessage(RoutingContext ctx, Exchange exchange) {
+        final Message result = new DefaultMessage(exchange);
 
-        populateCamelHeaders(ctx, result.getHeaders(), exchange, headerFilterStrategy);
+        final HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy();
+        populateCamelHeaders(ctx, result.getHeaders(), exchange, headerFilterStrategy );
         final String mimeType = ctx.parsedHeaders().contentType().value();
         final boolean isMultipartFormData = "multipart/form-data".equals(mimeType);
         if ("application/x-www-form-urlencoded".equals(mimeType) || isMultipartFormData) {
@@ -341,8 +342,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
             final Map<String, Object> body = new HashMap<>();
             for (String key : formData.names()) {
                 for (String value : formData.getAll(key)) {
-                    if (headerFilterStrategy != null
-                        && !headerFilterStrategy.applyFilterToExternalHeaders(key, value, exchange)) {
+                    if (headerFilterStrategy != null && !headerFilterStrategy.applyFilterToExternalHeaders(key, value, exchange)) {
                         appendHeader(result.getHeaders(), key, value);
                         appendHeader(body, key, value);
                     }
@@ -350,7 +350,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
             }
             result.setBody(body);
             if (isMultipartFormData) {
-                populateAttachments(ctx, result, fileNameExtWhitelist);
+                populateAttachments(ctx.fileUploads(), result);
             }
         } else {
             //extract body by myself if undertow parser didn't handle and the method is allowed to have one
@@ -384,9 +384,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
         headers.put(key, value);
     }
 
-    static void populateAttachments(RoutingContext ctx, Message message, String fileNameExtWhitelist) {
-        final Set<FileUpload> uploads = ctx.fileUploads();
-
+    void populateAttachments(Set<FileUpload> uploads, Message message) {
         for (FileUpload upload : uploads) {
             final String name = upload.name();
             final String fileName = upload.fileName();
@@ -405,13 +403,11 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
             }
             if (accepted) {
                 final File localFile = new File(upload.uploadedFileName());
-                final AttachmentMessage am = message.getExchange().getMessage(AttachmentMessage.class);
-                am.addAttachment(fileName, new DataHandler(new CamelFileDataSource(localFile, fileName)));
+                uploadAttacher.attachUpload(localFile, fileName, message);
             } else {
                 LOG.debugf("Cannot add file as attachment: %s because the file is not accepted according to fileNameExtWhitelist: %s", fileName, fileNameExtWhitelist);
             }
         }
     }
 
-
-}
\ No newline at end of file
+}
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
index 3e44401..2e7db4d 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
@@ -27,20 +27,23 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
+import org.apache.camel.quarkus.core.UploadAttacher;
 
 
 public class QuarkusPlatformHttpEngine implements PlatformHttpEngine {
     private final Router router;
     private final List<Handler<RoutingContext>> handlers;
+    private final UploadAttacher uploadAttacher;
 
-    public QuarkusPlatformHttpEngine(Router router, List<Handler<RoutingContext>> handlers) {
+    public QuarkusPlatformHttpEngine(Router router, List<Handler<RoutingContext>> handlers, UploadAttacher uploadAttacher) {
         this.router = router;
         this.handlers = new ArrayList<>(handlers);
+        this.uploadAttacher = uploadAttacher;
     }
 
     @Override
     public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor processor) {
-        return new QuarkusPlatformHttpConsumer(endpoint, processor, router, handlers);
+        return new QuarkusPlatformHttpConsumer(endpoint, processor, router, handlers, uploadAttacher);
     }
 
     public List<Handler<RoutingContext>> getHandlers() {
diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http/pom.xml
index 09a0d07..2b72ebd 100644
--- a/integration-tests/platform-http/pom.xml
+++ b/integration-tests/platform-http/pom.xml
@@ -44,6 +44,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-log</artifactId>
         </dependency>
+        <dependency><!-- Leave this one out (and save ~560 kB of the native image) unless you want to attach uploads to the camel message -->
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-attachments</artifactId>
+        </dependency>
 
         <!-- test dependencies -->
         <dependency>


[camel-quarkus] 04/04: Add more platform-http tests

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit f5243c6a82dfde937673e80d3e0c5acad5aaf390
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Oct 23 15:03:47 2019 +0200

    Add more platform-http tests
---
 .../http/runtime/QuarkusPlatformHttpConsumer.java  |  1 +
 integration-tests/platform-http/pom.xml            |  1 +
 .../platform/http/it/PlatformHttpRouteBuilder.java | 31 ++++++++++
 .../platform/http/it/TestHeaderFilterStrategy.java | 34 +++++++++++
 .../component/http/server/it/PlatformHttpTest.java | 71 +++++++++++++++++++++-
 5 files changed, 137 insertions(+), 1 deletion(-)

diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
index a852ec1..fa026ab 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
@@ -334,6 +334,7 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
         final Message result = new DefaultMessage(exchange);
 
         final HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy();
+        System.out.println("headerFilterStrategy = "+  headerFilterStrategy);
         populateCamelHeaders(ctx, result.getHeaders(), exchange, headerFilterStrategy );
         final String mimeType = ctx.parsedHeaders().contentType().value();
         final boolean isMultipartFormData = "multipart/form-data".equals(mimeType);
diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http/pom.xml
index 2b72ebd..d3c7f82 100644
--- a/integration-tests/platform-http/pom.xml
+++ b/integration-tests/platform-http/pom.xml
@@ -130,6 +130,7 @@
                                     <enableJni>true</enableJni>
                                     <enableAllSecurityServices>true</enableAllSecurityServices>
                                     <disableReports>true</disableReports>
+                                    <addAllCharsets>true</addAllCharsets><!-- Required by the encoding() test -->
                                 </configuration>
                             </execution>
                         </executions>
diff --git a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
index b675563..98b3a0d 100644
--- a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
+++ b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
@@ -17,9 +17,13 @@
 package org.apache.camel.quarkus.component.platform.http.it;
 
 import java.io.ByteArrayOutputStream;
+import java.util.Locale;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 import javax.activation.DataHandler;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.attachment.AttachmentMessage;
 import org.apache.camel.builder.RouteBuilder;
 
@@ -32,12 +36,14 @@ public class PlatformHttpRouteBuilder extends RouteBuilder {
                 .setBody(constant("GET: /rest-get"))
                 .endRest()
             .post("/platform-http/rest-post")
+                .consumes("text/plain").produces("text/plain")
                 .route()
                 .setBody(constant("POST: /rest-post"))
                 .endRest();
 
         from("platform-http:/platform-http/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}"));
         from("platform-http:/platform-http/get-post?httpMethodRestrict=GET,POST").setBody(simple("Hello ${body}"));
+
         from("platform-http:/platform-http/multipart?httpMethodRestrict=POST")
             .to("log:multipart")
             .process(e -> {
@@ -48,5 +54,30 @@ public class PlatformHttpRouteBuilder extends RouteBuilder {
                     e.getMessage().setBody(out.toByteArray());
                 }
             });
+
+        from("platform-http:/platform-http/form-urlencoded?httpMethodRestrict=POST")
+            .to("log:form-urlencoded")
+            .setBody(e ->
+                ((Map<String, Object>)e.getMessage().getBody(Map.class)).entrySet().stream()
+                    .map(en -> en.getKey() + "=" + en.getValue().toString().toUpperCase(Locale.US))
+                    .collect(Collectors.joining("\n")));
+
+        from("platform-http:/platform-http/header-filter-strategy?httpMethodRestrict=GET&headerFilterStrategy=#TestHeaderFilterStrategy")
+            .to("log:header-filter-strategy")
+            .setBody(simple("k1=${header.k1}\nk2=${header.k2}"));
+
+        from("platform-http:/platform-http/multi-value-params?httpMethodRestrict=GET")
+            .to("log:multi-value-params")
+            .setBody(simple("k1=${header.k1}"));
+
+        from("platform-http:/platform-http/encoding?httpMethodRestrict=POST")
+            .to("log:encoding")
+            .setBody(e -> e.getMessage().getBody(String.class))
+            .setHeader("Content-Type").constant("text/plain ; charset=UTF-8");
+
+        from("platform-http:/platform-http/response-code-299?httpMethodRestrict=GET")
+            .to("log:response-code")
+            .setHeader(Exchange.HTTP_RESPONSE_CODE).constant(299);
+
     }
 }
diff --git a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/TestHeaderFilterStrategy.java b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/TestHeaderFilterStrategy.java
new file mode 100644
index 0000000..2d77171
--- /dev/null
+++ b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/TestHeaderFilterStrategy.java
@@ -0,0 +1,34 @@
+/*
+ * 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.quarkus.component.platform.http.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+import org.apache.camel.component.platform.http.PlatformHttpHeaderFilterStrategy;
+
+@ApplicationScoped
+@Named("TestHeaderFilterStrategy")
+public class TestHeaderFilterStrategy extends PlatformHttpHeaderFilterStrategy {
+
+    @Override
+    protected void initialize() {
+        super.initialize();
+        getInFilter().add("k1");
+    }
+
+}
diff --git a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
index 51aa218..6b19606 100644
--- a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
+++ b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
@@ -20,10 +20,14 @@ import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+
 @QuarkusTest
 class PlatformHttpTest {
     @Test
@@ -53,10 +57,21 @@ class PlatformHttpTest {
     public void rest() throws Throwable {
         RestAssured.get("/platform-http/rest-get")
             .then().body(equalTo("GET: /rest-get"));
-        RestAssured.post("/platform-http/rest-post")
+        RestAssured.given()
+            .contentType("text/plain")
+            .post("/platform-http/rest-post")
             .then().body(equalTo("POST: /rest-post"));
     }
 
+    @Disabled("See https://github.com/apache/camel-quarkus/issues/326")
+    @Test
+    public void restConsumes() throws Throwable {
+        RestAssured.given()
+            .contentType("application/json")
+            .post("/platform-http/rest-post")
+            .then().statusCode(415);
+    }
+
     @Test
     public void invalidMethod() {
         RestAssured.post("/platform-http/hello")
@@ -81,4 +96,58 @@ class PlatformHttpTest {
         Assertions.assertArrayEquals(bytes, returnedBytes);
     }
 
+    @Test
+    public void formUrlEncoded() {
+        RestAssured.given().contentType("application/x-www-form-urlencoded")
+            .formParam("k1", "v1")
+            .formParam("k2", "v2")
+            .post("/platform-http/form-urlencoded")
+            .then()
+            .statusCode(200)
+            .body(equalTo("k1=V1\nk2=V2"));
+    }
+
+    @Test
+    public void customHeaderFilterStrategy() {
+        RestAssured.given()
+            .queryParam("k1", "v1")
+            .queryParam("k2", "v2")
+            .get("/platform-http/header-filter-strategy")
+            .then()
+            .statusCode(200)
+            .body(equalTo("k1=\nk2=v2")); // k1 filtered out by TestHeaderFilterStrategy
+    }
+
+    @Test
+    public void multiValueParams() {
+        RestAssured.given()
+            .queryParam("k1", "v1")
+            .queryParam("k1", "v2")
+            .get("/platform-http/multi-value-params")
+            .then()
+            .statusCode(200)
+            .body(equalTo("k1=[v1, v2]"));
+    }
+
+    @Test
+    public void encoding() throws UnsupportedEncodingException {
+        final String outgoingEncoding = "ISO-8859-2";
+        final String bodyText = "Ťava dvojhrbá"; // Camelus bactrianus in Slovak
+        final byte[] returnedBytes = RestAssured.given()
+            .contentType("text/plain; charset="+ outgoingEncoding)
+            .body(bodyText.getBytes(outgoingEncoding))
+            .post("/platform-http/encoding")
+            .then()
+            .statusCode(200)
+            .extract().body().asByteArray();
+        Assertions.assertArrayEquals(bodyText.getBytes(StandardCharsets.UTF_8), returnedBytes);
+    }
+
+    @Test
+    public void responseCodeViaHeader() throws UnsupportedEncodingException {
+        RestAssured.given()
+            .get("/platform-http/response-code-299")
+            .then()
+            .statusCode(299);
+    }
 }


[camel-quarkus] 02/04: Fix #324 Document the platform-http extension

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 228bec793ad5faa4294210a4a5ccac56eb52b0e9
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Oct 23 11:45:46 2019 +0200

    Fix #324 Document the platform-http extension
---
 .../ROOT/pages/extensions/platform-http.adoc       | 99 ++++++++++++++++++++++
 .../pages/list-of-camel-quarkus-extensions.adoc    |  2 +-
 extensions/readme.adoc                             |  2 +-
 3 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/docs/modules/ROOT/pages/extensions/platform-http.adoc b/docs/modules/ROOT/pages/extensions/platform-http.adoc
new file mode 100644
index 0000000..658e17f
--- /dev/null
+++ b/docs/modules/ROOT/pages/extensions/platform-http.adoc
@@ -0,0 +1,99 @@
+[[platform-http]]
+= Platform HTTP Extension
+
+*Since Camel Quarkus 0.3.0*
+
+This extension allows for creating HTTP endpoints for consuming HTTP requests.
+
+It is built on top of Eclipse Wert.x Web service provided by the `quarkus-vertx-web` extension.
+
+To use this extension add the following dependency to your `pom.xml`:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-platform-http</artifactId>
+</dependency>
+----
+
+
+== Basic Usage
+
+Serve all HTTP methods on the `/hello` endpoint:
+
+[source,java]
+----
+from("platform-http:/hello").setBody(simple("Hello ${header.name}"));
+----
+
+Serve only GET requests on the `/hello` endpoint:
+
+[source,java]
+----
+from("platform-http:/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}"));
+----
+
+== Using `platform-http` via Camel REST DSL
+
+To be able to use Camel REST DSL with the `platform-http` component, add `camel-quarkus-rest` in addition to `camel-quarkus-platform-http` to your `pom.xml`:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-rest</artifactId>
+</dependency>
+----
+
+Then you can use the Camel REST DSL:
+
+[source,java]
+----
+rest()
+    .get("/my-get-endpoint")
+        .route()
+        .setBody(constant("Hello from /my-get-endpoint"))
+        .endRest()
+    .post("/my-post-endpoint")
+        .route()
+        .setBody(constant("Hello from /my-post-endpoint"))
+        .endRest();
+----
+
+
+== Handling `multipart/form-data` file uploads
+
+If you want Camel Quarkus to attach uploaded files to Camel messages for you, you need to add the following optional
+dependency to your `pom.xml`:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-attachments</artifactId>
+</dependency>
+----
+
+You can restrict the uploads to certain file extensions by white listing them:
+
+[source,java]
+----
+from("platform-http:/upload/multipart?fileNameExtWhitelist=adoc,txt&httpMethodRestrict=POST")
+    .to("log:multipart")
+    .process(e -> {
+        final AttachmentMessage am = e.getMessage(AttachmentMessage.class);
+        if (am.hasAttachments()) {
+            am.getAttachments().forEach((fileName, dataHandler) -> {
+                try (InputStream in = dataHandler.getInputStream()) {
+                    // do something with the input stream
+                } catch (IOException ioe) {
+                    throw new RuntimeException(ioe);
+                }
+            });
+        }
+    });
+----
+
+Also check the `quarkus.http.body.*` configuration options in
+https://quarkus.io/guides/all-config[Quarkus documentation], esp. `quarkus.http.body.handle-file-uploads`, `quarkus.http.body.uploads-directory` and `quarkus.http.body.delete-uploaded-files-on-end`.
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index d1d9923..3f247bf 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -140,7 +140,7 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
-| (camel-quarkus-platform-http) | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
+| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
 | (camel-quarkus-reactive-executor) | 0.2.1 | To use Quarkus reactive executor with Camel
 
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 49929c2..27c3d2d 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -142,7 +142,7 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
-| (camel-quarkus-platform-http) | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
+| xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.2.1 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
 | (camel-quarkus-reactive-executor) | 0.2.1 | To use Quarkus reactive executor with Camel