You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/03/10 10:39:38 UTC

[camel-quarkus] branch master updated: HL7 Native support

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 10d2f41  HL7 Native support
10d2f41 is described below

commit 10d2f4140a4778e4df5e143a6bfcedfab87e0c3e
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Mar 9 15:44:43 2021 +0000

    HL7 Native support
    
    Fixes #1747
---
 .../ROOT/pages/reference/extensions/hl7.adoc       |  15 +-
 .../ROOT/partials/reference/dataformats/hl7.adoc   |   6 +-
 .../partials/reference/languages/hl7terser.adoc    |   6 +-
 .../component/hl7/deployment/Hl7Processor.java     |  46 -----
 extensions-jvm/hl7/integration-test/pom.xml        |  83 ---------
 .../quarkus/component/hl7/it/Hl7Resource.java      |  64 -------
 extensions-jvm/pom.xml                             |   1 -
 .../hl7/deployment/pom.xml                         |   0
 .../component/hl7/deployment/Hl7Processor.java     | 101 +++++++++++
 {extensions-jvm => extensions}/hl7/pom.xml         |   1 -
 {extensions-jvm => extensions}/hl7/runtime/pom.xml |   1 +
 .../hl7/runtime/src/main/doc/limitations.adoc      |   3 +
 .../main/resources/META-INF/quarkus-extension.yaml |   3 +-
 extensions/pom.xml                                 |   1 +
 integration-tests/hl7/pom.xml                      | 193 +++++++++++++++++++++
 .../quarkus/component/hl7/it/Hl7Producers.java     |  89 ++++++++++
 .../quarkus/component/hl7/it/Hl7Resource.java      | 156 +++++++++++++++++
 .../camel/quarkus/component/hl7/it/Hl7Routes.java  |  60 +++++++
 .../camel/quarkus/component/hl7/it/Hl7IT.java      |  24 +--
 .../camel/quarkus/component/hl7/it/Hl7Test.java    | 157 +++++++++++++++++
 .../quarkus/component/hl7/it/Hl7TestResource.java  |  31 ++--
 .../hl7/src/test/resources/hl7-2.2-pid.txt         |   2 +
 integration-tests/pom.xml                          |   1 +
 pom.xml                                            |   3 +-
 poms/bom/pom.xml                                   |  42 ++++-
 tooling/scripts/test-categories.yaml               |   1 +
 26 files changed, 842 insertions(+), 248 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/hl7.adoc b/docs/modules/ROOT/pages/reference/extensions/hl7.adoc
index fff58d5..44c60c6 100644
--- a/docs/modules/ROOT/pages/reference/extensions/hl7.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/hl7.adoc
@@ -2,15 +2,15 @@
 // This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
 = HL7
 :cq-artifact-id: camel-quarkus-hl7
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
 :cq-description: Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec.
 :cq-deprecated: false
 :cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.8.0
 
 [.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.8.0##
 
 Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec.
 
@@ -32,3 +32,10 @@ Please refer to the above links for usage and configuration details.
 ----
 
 Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== Camel Quarkus limitations
+
+For MLLP with TCP, Netty is the only supported means of running an Hl7 MLLP listener. Mina is not supported since it has no GraalVM native support at present.
+
+Optional support for `HL7MLLPNettyEncoderFactory` & `HL7MLLPNettyDecoderFactory` codecs can be obtained by adding a dependency in your project `pom.xml` to `camel-quarkus-netty`.
+
diff --git a/docs/modules/ROOT/partials/reference/dataformats/hl7.adoc b/docs/modules/ROOT/partials/reference/dataformats/hl7.adoc
index 43c3e87..7452e76 100644
--- a/docs/modules/ROOT/partials/reference/dataformats/hl7.adoc
+++ b/docs/modules/ROOT/partials/reference/dataformats/hl7.adoc
@@ -2,11 +2,11 @@
 // This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
 :cq-artifact-id: camel-quarkus-hl7
 :cq-artifact-id-base: hl7
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
 :cq-deprecated: false
 :cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.8.0
 :cq-camel-part-name: hl7
 :cq-camel-part-title: HL7
 :cq-camel-part-description: Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec.
diff --git a/docs/modules/ROOT/partials/reference/languages/hl7terser.adoc b/docs/modules/ROOT/partials/reference/languages/hl7terser.adoc
index aa1971c..4d05135 100644
--- a/docs/modules/ROOT/partials/reference/languages/hl7terser.adoc
+++ b/docs/modules/ROOT/partials/reference/languages/hl7terser.adoc
@@ -2,11 +2,11 @@
 // This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
 :cq-artifact-id: camel-quarkus-hl7
 :cq-artifact-id-base: hl7
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
 :cq-deprecated: false
 :cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.8.0
 :cq-camel-part-name: hl7terser
 :cq-camel-part-title: HL7 Terser
 :cq-camel-part-description: Get the value of an HL7 message field specified by terse location specification syntax.
diff --git a/extensions-jvm/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java b/extensions-jvm/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
deleted file mode 100644
index d487bf8..0000000
--- a/extensions-jvm/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.hl7.deployment;
-
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
-
-class Hl7Processor {
-
-    private static final Logger LOG = Logger.getLogger(Hl7Processor.class);
-    private static final String FEATURE = "camel-hl7";
-
-    @BuildStep
-    FeatureBuildItem feature() {
-        return new FeatureBuildItem(FEATURE);
-    }
-
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
-    }
-}
diff --git a/extensions-jvm/hl7/integration-test/pom.xml b/extensions-jvm/hl7/integration-test/pom.xml
deleted file mode 100644
index 0970177..0000000
--- a/extensions-jvm/hl7/integration-test/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-build-parent-it</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-        <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
-    </parent>
-
-    <artifactId>camel-quarkus-hl7-integration-test</artifactId>
-    <name>Camel Quarkus :: HL7 :: Integration Test</name>
-    <description>Integration tests for Camel Quarkus HL7 extension</description>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-bom-test</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-hl7</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy</artifactId>
-        </dependency>
-
-        <!-- test dependencies -->
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-junit5</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>io.rest-assured</groupId>
-            <artifactId>rest-assured</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-hl7-deployment</artifactId>
-            <version>${project.version}</version>
-            <type>pom</type>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>*</groupId>
-                    <artifactId>*</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-    </dependencies>
-
-</project>
diff --git a/extensions-jvm/hl7/integration-test/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java b/extensions-jvm/hl7/integration-test/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java
deleted file mode 100644
index d0032fb..0000000
--- a/extensions-jvm/hl7/integration-test/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.hl7.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/hl7")
-@ApplicationScoped
-public class Hl7Resource {
-
-    private static final Logger LOG = Logger.getLogger(Hl7Resource.class);
-
-    private static final String DATAFORMAT_HL7 = "hl7";
-    private static final String LANGUAGE_HL7TERSER = "hl7terser";
-    @Inject
-    CamelContext context;
-
-    @Path("/load/dataformat/hl7")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response loadDataformatHl7() throws Exception {
-        /* This is an autogenerated test */
-        if (context.resolveDataFormat(DATAFORMAT_HL7) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", DATAFORMAT_HL7);
-        return Response.status(500, DATAFORMAT_HL7 + " could not be loaded from the Camel context").build();
-    }
-
-    @Path("/load/language/hl7terser")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response loadLanguageHl7terser() throws Exception {
-        /* This is an autogenerated test */
-        if (context.resolveLanguage(LANGUAGE_HL7TERSER) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", LANGUAGE_HL7TERSER);
-        return Response.status(500, LANGUAGE_HL7TERSER + " could not be loaded from the Camel context").build();
-    }
-}
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index 1ad169e..ec38785 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -68,7 +68,6 @@
         <module>guava-eventbus</module>
         <module>hbase</module>
         <module>hdfs</module>
-        <module>hl7</module>
         <module>huaweicloud-smn</module>
         <module>iec60870</module>
         <module>ignite</module>
diff --git a/extensions-jvm/hl7/deployment/pom.xml b/extensions/hl7/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/hl7/deployment/pom.xml
rename to extensions/hl7/deployment/pom.xml
diff --git a/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java b/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
new file mode 100644
index 0000000..3824fb9
--- /dev/null
+++ b/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
@@ -0,0 +1,101 @@
+/*
+ * 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.hl7.deployment;
+
+import java.util.List;
+
+import ca.uhn.hl7v2.model.Structure;
+import ca.uhn.hl7v2.model.Type;
+import io.quarkus.bootstrap.model.AppDependency;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import org.apache.camel.component.hl7.Hl7Terser;
+import org.apache.camel.quarkus.core.deployment.util.CamelSupport;
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationTarget;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+
+class Hl7Processor {
+
+    private static final String FEATURE = "camel-hl7";
+    private static final String CA_UHN_HAPI_GROUP_ID = "ca.uhn.hapi";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void indexDependencies(BuildProducer<IndexDependencyBuildItem> indexedDependency, CurateOutcomeBuildItem curateOutcome) {
+        // Index any optional hapi-structures dependencies present on the classpath
+        List<AppDependency> userDependencies = curateOutcome.getEffectiveModel().getUserDependencies();
+        userDependencies.stream()
+                .map(appDependency -> appDependency.getArtifact())
+                .filter(appArtifact -> appArtifact.getGroupId().equals(CA_UHN_HAPI_GROUP_ID)
+                        && appArtifact.getArtifactId().startsWith("hapi-structures-"))
+                .map(appArtifact -> new IndexDependencyBuildItem(appArtifact.getGroupId(), appArtifact.getArtifactId()))
+                .forEach(indexedDependency::produce);
+
+        // hapi-base will always be present but needs to be indexed
+        indexedDependency.produce(new IndexDependencyBuildItem(CA_UHN_HAPI_GROUP_ID, "hapi-base"));
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) {
+        IndexView index = combinedIndex.getIndex();
+
+        // Register hapi model types for reflection
+        String[] hapiStructureClasses = index.getAllKnownImplementors(DotName.createSimple(Structure.class.getName()))
+                .stream()
+                .map(classInfo -> classInfo.name().toString())
+                .toArray(String[]::new);
+
+        String[] hapiTypeClasses = index.getAllKnownImplementors(DotName.createSimple(Type.class.getName()))
+                .stream()
+                .map(classInfo -> classInfo.name().toString())
+                .toArray(String[]::new);
+
+        reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, hapiStructureClasses));
+        reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, hapiTypeClasses));
+
+        // Beans that have the Hl7Terser annotation require reflective access
+        String[] terserBeans = index.getAnnotations(DotName.createSimple(Hl7Terser.class.getName()))
+                .stream()
+                .map(AnnotationInstance::target)
+                .map(annotationTarget -> {
+                    if (annotationTarget.kind().equals(AnnotationTarget.Kind.FIELD)) {
+                        return annotationTarget.asType().asClass();
+                    } else if (annotationTarget.kind().equals(AnnotationTarget.Kind.METHOD)) {
+                        return annotationTarget.asMethod().declaringClass();
+                    } else if (annotationTarget.kind().equals(AnnotationTarget.Kind.METHOD_PARAMETER)) {
+                        return annotationTarget.asMethodParameter().method().declaringClass();
+                    }
+                    return null;
+                })
+                .filter(CamelSupport::isConcrete)
+                .map(classInfo -> classInfo.name().toString())
+                .toArray(String[]::new);
+
+        reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, terserBeans));
+    }
+}
diff --git a/extensions-jvm/hl7/pom.xml b/extensions/hl7/pom.xml
similarity index 97%
rename from extensions-jvm/hl7/pom.xml
rename to extensions/hl7/pom.xml
index fb7f392..769570f 100644
--- a/extensions-jvm/hl7/pom.xml
+++ b/extensions/hl7/pom.xml
@@ -33,6 +33,5 @@
     <modules>
         <module>deployment</module>
         <module>runtime</module>
-        <module>integration-test</module>
     </modules>
 </project>
diff --git a/extensions-jvm/hl7/runtime/pom.xml b/extensions/hl7/runtime/pom.xml
similarity index 98%
rename from extensions-jvm/hl7/runtime/pom.xml
rename to extensions/hl7/runtime/pom.xml
index bb3b5e9..254ab1e 100644
--- a/extensions-jvm/hl7/runtime/pom.xml
+++ b/extensions/hl7/runtime/pom.xml
@@ -32,6 +32,7 @@
 
     <properties>
         <camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+        <camel.quarkus.nativeSince>1.8.0</camel.quarkus.nativeSince>
     </properties>
 
     <dependencyManagement>
diff --git a/extensions/hl7/runtime/src/main/doc/limitations.adoc b/extensions/hl7/runtime/src/main/doc/limitations.adoc
new file mode 100644
index 0000000..f7bb2b8
--- /dev/null
+++ b/extensions/hl7/runtime/src/main/doc/limitations.adoc
@@ -0,0 +1,3 @@
+For MLLP with TCP, Netty is the only supported means of running an Hl7 MLLP listener. Mina is not supported since it has no GraalVM native support at present.
+
+Optional support for `HL7MLLPNettyEncoderFactory` & `HL7MLLPNettyDecoderFactory` codecs can be obtained by adding a dependency in your project `pom.xml` to `camel-quarkus-netty`.
diff --git a/extensions-jvm/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 97%
rename from extensions-jvm/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 990c660..28c45e3 100644
--- a/extensions-jvm/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/hl7/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,9 +24,8 @@
 name: "Camel HL7"
 description: "Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec"
 metadata:
-  unlisted: true
   guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/hl7.html"
   categories:
   - "integration"
   status:
-  - "preview"
+  - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 6d50929..0cde2f4 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -132,6 +132,7 @@
         <module>gson</module>
         <module>hazelcast</module>
         <module>headersmap</module>
+        <module>hl7</module>
         <module>http</module>
         <module>hystrix</module>
         <module>ical</module>
diff --git a/integration-tests/hl7/pom.xml b/integration-tests/hl7/pom.xml
new file mode 100644
index 0000000..11466a8
--- /dev/null
+++ b/integration-tests/hl7/pom.xml
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-hl7</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: HL7</name>
+    <description>Integration tests for Camel Quarkus HL7 extension</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom-test</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-bean</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-hl7</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-mock</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-netty</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>ca.uhn.hapi</groupId>
+            <artifactId>hapi-structures-v22</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-test-support</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-bean-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-hl7-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-mock-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-netty-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.package.type>native</quarkus.package.type>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Producers.java b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Producers.java
new file mode 100644
index 0000000..ffe40b0
--- /dev/null
+++ b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Producers.java
@@ -0,0 +1,89 @@
+/*
+ * 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.hl7.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+import ca.uhn.hl7v2.DefaultHapiContext;
+import ca.uhn.hl7v2.HapiContext;
+import ca.uhn.hl7v2.Version;
+import ca.uhn.hl7v2.parser.GenericParser;
+import ca.uhn.hl7v2.parser.Parser;
+import ca.uhn.hl7v2.validation.ValidationContext;
+import ca.uhn.hl7v2.validation.builder.ValidationRuleBuilder;
+import ca.uhn.hl7v2.validation.impl.ValidationContextFactory;
+import org.apache.camel.component.hl7.HL7DataFormat;
+import org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory;
+import org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory;
+import org.apache.camel.component.hl7.Hl7Terser;
+import org.apache.camel.spi.DataFormat;
+
+public class Hl7Producers {
+
+    @ApplicationScoped
+    @Named("hl7encoder")
+    public HL7MLLPNettyEncoderFactory hl7MLLPNettyEncoderFactory() {
+        HL7MLLPNettyEncoderFactory factory = new HL7MLLPNettyEncoderFactory();
+        factory.setConvertLFtoCR(true);
+        return factory;
+    }
+
+    @ApplicationScoped
+    @Named("hl7decoder")
+    public HL7MLLPNettyDecoderFactory hl7MLLPNettyDecoderFactory() {
+        HL7MLLPNettyDecoderFactory factory = new HL7MLLPNettyDecoderFactory();
+        factory.setConvertLFtoCR(true);
+        return factory;
+    }
+
+    @ApplicationScoped
+    @Named
+    public DataFormat hl7DataFormat() {
+        return new HL7DataFormat();
+    }
+
+    @ApplicationScoped
+    @Named
+    public TerserBean terserBean() {
+        return new TerserBean();
+    }
+
+    @ApplicationScoped
+    @Named
+    public Parser parser() {
+        ValidationRuleBuilder builder = new ValidationRuleBuilder() {
+            @Override
+            protected void configure() {
+                // Configure a fake validation scenario where the patient id should match a specific value
+                forVersion(Version.V22)
+                        .message("ADT", "*")
+                        .terser("PID-2", isEqual("00009999"));
+            }
+        };
+
+        ValidationContext customValidationContext = ValidationContextFactory.fromBuilder(builder);
+        HapiContext customContext = new DefaultHapiContext(customValidationContext);
+        return new GenericParser(customContext);
+    }
+
+    static class TerserBean {
+        public String patientId(@Hl7Terser(value = "PID-3-1") String patientId) {
+            return patientId;
+        }
+    }
+}
diff --git a/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java
new file mode 100644
index 0000000..f9c33d5
--- /dev/null
+++ b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Resource.java
@@ -0,0 +1,156 @@
+/*
+ * 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.hl7.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import ca.uhn.hl7v2.model.v22.datatype.AD;
+import ca.uhn.hl7v2.model.v22.datatype.CK;
+import ca.uhn.hl7v2.model.v22.datatype.PN;
+import ca.uhn.hl7v2.model.v22.datatype.ST;
+import ca.uhn.hl7v2.model.v22.datatype.TN;
+import ca.uhn.hl7v2.model.v22.message.ADT_A01;
+import ca.uhn.hl7v2.model.v22.segment.PID;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+@Path("/hl7")
+@ApplicationScoped
+public class Hl7Resource {
+
+    @Inject
+    CamelContext context;
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/mllp")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject mllp(String message) throws Exception {
+        MockEndpoint endpoint = context.getEndpoint("mock:result", MockEndpoint.class);
+        endpoint.expectedMessageCount(1);
+
+        producerTemplate.sendBody(
+                "netty:tcp://localhost:{{camel.hl7.test-tcp-port}}?sync=true&encoders=#hl7encoder&decoders=#hl7decoder",
+                message);
+
+        endpoint.assertIsSatisfied(5000L);
+        Exchange exchange = endpoint.getExchanges().get(0);
+        ADT_A01 result = exchange.getMessage().getBody(ADT_A01.class);
+
+        return adtToJsonObject(result);
+    }
+
+    @Path("/marshalUnmarshal")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String marshalUnmarshal(String message) throws Exception {
+        return producerTemplate.requestBody("direct:marshalUnmarshal", message, String.class);
+    }
+
+    @Path("/validate")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response validate(String message) throws Exception {
+        Exchange exchange = producerTemplate.request("direct:validate", e -> e.getMessage().setBody(message));
+        if (exchange.isFailed()) {
+            Exception exception = exchange.getException();
+            return Response.serverError().entity(exception.getMessage()).build();
+        }
+        return Response.ok().build();
+    }
+
+    @Path("/validate/custom")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response validateCustom(String message) throws Exception {
+        Exchange exchange = producerTemplate.request("direct:validateCustom", e -> e.getMessage().setBody(message));
+        if (exchange.isFailed()) {
+            Exception exception = exchange.getException();
+            return Response.serverError().entity(exception.getMessage()).build();
+        }
+        return Response.ok().build();
+    }
+
+    @Path("/hl7terser")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String hl7terser(String message) throws Exception {
+        Exchange exchange = producerTemplate.request("direct:hl7terser", e -> e.getMessage().setBody(message));
+        return exchange.getMessage().getHeader("PATIENT_ID", String.class);
+    }
+
+    @Path("/hl7terser/bean")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String hl7terserBean(String message) throws Exception {
+        return producerTemplate.requestBody("direct:hl7terserBean", message, String.class);
+    }
+
+    @Path("/xml")
+    @POST
+    @Consumes(MediaType.APPLICATION_XML)
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject hl7Xml(String messageXml) throws Exception {
+        ADT_A01 result = producerTemplate.requestBody("direct:unmarshalXml", messageXml, ADT_A01.class);
+        return adtToJsonObject(result);
+    }
+
+    private JsonObject adtToJsonObject(ADT_A01 result) {
+        JsonObjectBuilder objectBuilder = Json.createObjectBuilder();
+
+        PID pid = result.getPID();
+        PN patientName = pid.getPatientName();
+        objectBuilder.add("first_name", patientName.getGivenName().getValue());
+        objectBuilder.add("last_name", patientName.getFamilyName().getValue());
+
+        ST birthPlace = pid.getBirthPlace();
+        objectBuilder.add("birth_place", birthPlace.getValue());
+
+        CK patientAccountNumber = pid.getPatientAccountNumber();
+        objectBuilder.add("account_number", patientAccountNumber.getIDNumber().getValue());
+
+        AD patientAddress = pid.getPatientAddress(0);
+        objectBuilder.add("street", patientAddress.getAd1_StreetAddress().getValue());
+        objectBuilder.add("city", patientAddress.getAd3_City().getValue());
+        objectBuilder.add("zip", patientAddress.getZipOrPostalCode().getValue());
+
+        TN phoneNumber = pid.getPhoneNumberHome(0);
+        objectBuilder.add("phone", phoneNumber.getValue());
+
+        return objectBuilder.build();
+    }
+}
diff --git a/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Routes.java b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Routes.java
new file mode 100644
index 0000000..6daf8c2
--- /dev/null
+++ b/integration-tests/hl7/src/main/java/org/apache/camel/quarkus/component/hl7/it/Hl7Routes.java
@@ -0,0 +1,60 @@
+/*
+ * 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.hl7.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import ca.uhn.hl7v2.model.v22.message.ADT_A01;
+import ca.uhn.hl7v2.parser.Parser;
+import org.apache.camel.builder.RouteBuilder;
+
+import static org.apache.camel.component.hl7.HL7.hl7terser;
+
+@ApplicationScoped
+public class Hl7Routes extends RouteBuilder {
+
+    @Inject
+    Parser parser;
+
+    @Override
+    public void configure() throws Exception {
+        from("netty:tcp://localhost:{{camel.hl7.test-tcp-port}}?sync=true&encoders=#hl7encoder&decoders=#hl7decoder")
+                .convertBodyTo(ADT_A01.class)
+                .to("mock:result");
+
+        from("direct:validate")
+                .unmarshal("hl7DataFormat");
+
+        from("direct:validateCustom")
+                .unmarshal().hl7(false)
+                .marshal().hl7(parser);
+
+        from("direct:marshalUnmarshal")
+                .unmarshal("hl7DataFormat")
+                .marshal("hl7DataFormat");
+
+        from("direct:hl7terser")
+                .setHeader("PATIENT_ID", hl7terser("PID-3-1"));
+
+        from("direct:hl7terserBean")
+                .bean("terserBean");
+
+        from("direct:unmarshalXml")
+                .unmarshal("hl7DataFormat");
+    }
+}
diff --git a/extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7IT.java
similarity index 60%
copy from extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
copy to integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7IT.java
index e0ade62..95396f8 100644
--- a/extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
+++ b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7IT.java
@@ -16,27 +16,9 @@
  */
 package org.apache.camel.quarkus.component.hl7.it;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.NativeImageTest;
 
-@QuarkusTest
-class Hl7Test {
-
-    @Test
-    public void loadDataformatHl7() {
-        /* A simple autogenerated test */
-        RestAssured.get("/hl7/load/dataformat/hl7")
-                .then()
-                .statusCode(200);
-    }
-
-    @Test
-    public void loadLanguageHl7terser() {
-        /* A simple autogenerated test */
-        RestAssured.get("/hl7/load/language/hl7terser")
-                .then()
-                .statusCode(200);
-    }
+@NativeImageTest
+class Hl7IT extends Hl7Test {
 
 }
diff --git a/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
new file mode 100644
index 0000000..af55bbd
--- /dev/null
+++ b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
@@ -0,0 +1,157 @@
+/*
+ * 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.hl7.it;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import ca.uhn.hl7v2.DefaultHapiContext;
+import ca.uhn.hl7v2.HL7Exception;
+import ca.uhn.hl7v2.model.Message;
+import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
+import ca.uhn.hl7v2.parser.GenericParser;
+import ca.uhn.hl7v2.parser.ParserConfiguration;
+import ca.uhn.hl7v2.parser.UnexpectedSegmentBehaviourEnum;
+import ca.uhn.hl7v2.validation.ValidationContext;
+import ca.uhn.hl7v2.validation.impl.ValidationContextFactory;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.commons.io.IOUtils;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+@QuarkusTestResource(Hl7TestResource.class)
+class Hl7Test {
+
+    private static final String PID_MESSAGE = readPidFile();
+
+    @Test
+    public void nettyMllp() {
+        RestAssured.given()
+                .body(PID_MESSAGE)
+                .post("/hl7/mllp")
+                .then()
+                .statusCode(200)
+                .body(
+                        "first_name", is("JOHN"),
+                        "last_name", is("SMITH"),
+                        "birth_place", is("SA"),
+                        "account_number", is("0000444444"),
+                        "street", is("564 SPRING ST"),
+                        "city", is("NEEDHAM"),
+                        "zip", is("02494"),
+                        "phone", is("(818)565-1551"));
+    }
+
+    @Test
+    public void hl7DataFormatMarshalUnmarshal() {
+        RestAssured.given()
+                .body(PID_MESSAGE)
+                .post("/hl7/marshalUnmarshal")
+                .then()
+                .statusCode(200)
+                .body(is(PID_MESSAGE.replace("\n", "\r")));
+    }
+
+    @Test
+    public void hl7Terser() {
+        RestAssured.given()
+                .body(PID_MESSAGE)
+                .post("/hl7/hl7terser")
+                .then()
+                .statusCode(200)
+                .body(is("00001122"));
+    }
+
+    @Test
+    public void hl7TerserBean() {
+        RestAssured.given()
+                .body(PID_MESSAGE)
+                .post("/hl7/hl7terser/bean")
+                .then()
+                .statusCode(200)
+                .body(is("00001122"));
+    }
+
+    @Test
+    public void hl7Validate() {
+        // Make the PID message format invalid
+        String message = PID_MESSAGE.replace("\r", "\t");
+
+        RestAssured.given()
+                .body(message)
+                .post("/hl7/validate")
+                .then()
+                .statusCode(500)
+                .body(endsWith("PID is not recognized"));
+    }
+
+    @Test
+    public void hl7ValidateCustomParser() {
+        RestAssured.given()
+                .body(PID_MESSAGE)
+                .post("/hl7/validate/custom")
+                .then()
+                .statusCode(500)
+                .body(is("Validation failed:  '00009874' requires to be equal to 00009999 at PID-2(0)-1-1"));
+    }
+
+    @Test
+    public void hl7Xml() throws HL7Exception {
+        ValidationContext validationContext = ValidationContextFactory.noValidation();
+        ParserConfiguration parserConfiguration = new ParserConfiguration();
+        parserConfiguration.setDefaultObx2Type("ST");
+        parserConfiguration.setInvalidObx2Type("ST");
+        parserConfiguration.setUnexpectedSegmentBehaviour(UnexpectedSegmentBehaviourEnum.ADD_INLINE);
+        DefaultHapiContext context = new DefaultHapiContext(parserConfiguration, validationContext,
+                new DefaultModelClassFactory());
+        GenericParser parser = context.getGenericParser();
+
+        Message msg = parser.parse(PID_MESSAGE);
+        String xml = parser.encode(msg, "XML");
+
+        RestAssured.given()
+                .contentType(ContentType.XML)
+                .body(xml)
+                .post("/hl7/xml")
+                .then()
+                .statusCode(200)
+                .body(
+                        "first_name", is("JOHN"),
+                        "last_name", is("SMITH"),
+                        "birth_place", is("SA"),
+                        "account_number", is("0000444444"),
+                        "street", is("564 SPRING ST"),
+                        "city", is("NEEDHAM"),
+                        "zip", is("02494"),
+                        "phone", is("(818)565-1551"));
+    }
+
+    private static final String readPidFile() {
+        try {
+            String pidContent = IOUtils.toString(Hl7Test.class.getResourceAsStream("/hl7-2.2-pid.txt"), StandardCharsets.UTF_8);
+            return pidContent.replace("\n", "\r");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7TestResource.java
similarity index 61%
rename from extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
rename to integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7TestResource.java
index e0ade62..3ab8ed5 100644
--- a/extensions-jvm/hl7/integration-test/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7Test.java
+++ b/integration-tests/hl7/src/test/java/org/apache/camel/quarkus/component/hl7/it/Hl7TestResource.java
@@ -16,27 +16,22 @@
  */
 package org.apache.camel.quarkus.component.hl7.it;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import java.util.Map;
+import java.util.Objects;
 
-@QuarkusTest
-class Hl7Test {
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.apache.camel.quarkus.test.AvailablePortFinder;
 
-    @Test
-    public void loadDataformatHl7() {
-        /* A simple autogenerated test */
-        RestAssured.get("/hl7/load/dataformat/hl7")
-                .then()
-                .statusCode(200);
+public class Hl7TestResource implements QuarkusTestResourceLifecycleManager {
+    @Override
+    public Map<String, String> start() {
+        return AvailablePortFinder.reserveNetworkPorts(
+                Objects::toString,
+                "camel.hl7.test-tcp-port");
     }
 
-    @Test
-    public void loadLanguageHl7terser() {
-        /* A simple autogenerated test */
-        RestAssured.get("/hl7/load/language/hl7terser")
-                .then()
-                .statusCode(200);
+    @Override
+    public void stop() {
+        // Noop
     }
-
 }
diff --git a/integration-tests/hl7/src/test/resources/hl7-2.2-pid.txt b/integration-tests/hl7/src/test/resources/hl7-2.2-pid.txt
new file mode 100644
index 0000000..98c37b2
--- /dev/null
+++ b/integration-tests/hl7/src/test/resources/hl7-2.2-pid.txt
@@ -0,0 +1,2 @@
+MSH|^~\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01||P|2.2
+PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200| [...]
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 39fe196..53f096c 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -115,6 +115,7 @@
         <module>grpc</module>
         <module>hazelcast</module>
         <module>headersmap</module>
+        <module>hl7</module>
         <module>http</module>
         <module>hystrix</module>
         <module>infinispan</module>
diff --git a/pom.xml b/pom.xml
index 654ee2d..76b6940 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,7 +73,8 @@
         <guava.version>29.0-jre</guava.version>
         <gson.version>2.8.6</gson.version><!-- JSONata -->
         <hadoop2.version>${hadoop2-version}</hadoop2.version><!-- Spark -->
-        <hapi.version>${hapi-fhir-version}</hapi.version>
+        <hapi.version>${hapi-version}</hapi.version>
+        <hapi-fhir.version>${hapi-fhir-version}</hapi-fhir.version>
         <hazelcast.version>4.0.3</hazelcast.version><!-- keep in sync with quarkus-hazelcast-client -->
         <hbase.version>${hbase-version}</hbase.version><!-- Keep in sync with Camel -->
         <htrace.version>4.2.0-incubating</htrace.version><!-- Mess in hbase transitive deps -->
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 9b6588b..336109b 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -5622,9 +5622,49 @@
 
             <!--$ Other third party dependencies $-->
             <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v21</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v22</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v23</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v231</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v24</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v25</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v251</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ca.uhn.hapi</groupId>
+                <artifactId>hapi-structures-v26</artifactId>
+                <version>${hapi.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>ca.uhn.hapi.fhir</groupId>
                 <artifactId>hapi-fhir-server</artifactId>
-                <version>${hapi.version}</version>
+                <version>${hapi-fhir.version}</version>
             </dependency>
             <dependency>
                 <groupId>com.amazonaws</groupId>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 92853d0..63423d0 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -77,6 +77,7 @@ dataformats:
   - cbor
   - csv
   - dataformat
+  - hl7
   - jaxb
   - soap
   - syslog