This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 72b940e8d Fix #3333: new mllp-source and mllp-sink Kamelets (HL7 v2
over MLLP) (#3337)
72b940e8d is described below
commit 72b940e8d688d57ad6949cf9afb99531ac4733fa
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 00:15:14 2026 +0100
Fix #3333: new mllp-source and mllp-sink Kamelets (HL7 v2 over MLLP) (#3337)
mllp-source listens on a TCP port (all interfaces by default, like
webhook-source), gives each HL7 v2 message to the flow as text, read in
the charset of MSH-18, with the MSH fields in CamelMllp* headers, and
answers with an automatic ACK: AA, or AE when the flow fails. It removes
the CamelCharsetName exchange property the component sets (ISO-8859-1),
which would otherwise turn the text into bytes in ISO-8859-1 later on.
mllp-sink sends the body (text in `charset`, or bytes) and reads the
ACK: the body is unchanged, the ACK is in CamelMllpAcknowledgement*
headers, and AE/AR fails the message. It removes stale
CamelMllpAcknowledgement* headers and the CamelCharsetName header, and
sets the exchange property to `charset`, because the component lets
both win over its own charsetName.
TLS is left to the global SSL settings (camel.ssl.* with
camel.component.mllp.useGlobalSslContextParameters), checked by hand.
Citrus test MllpIT: mllp-sink sends to mllp-source in another
integration; body, headers, ACK, UTF-8 text, bytes, AE and AR.
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 32 ++++-
docs/modules/ROOT/nav.adoc | 2 +
kamelets/mllp-sink.kamelet.yaml | 116 +++++++++++++++++
kamelets/mllp-source.kamelet.yaml | 133 +++++++++++++++++++
.../main/resources/META-INF/kamelets-index.json | 20 +++
.../main/resources/kamelets/mllp-sink.kamelet.yaml | 116 +++++++++++++++++
.../resources/kamelets/mllp-source.kamelet.yaml | 133 +++++++++++++++++++
.../camel-kamelets-itest/src/test/java/MllpIT.java | 50 ++++++++
.../src/test/resources/mllp/mllp-sink-route.yaml | 92 +++++++++++++
.../resources/mllp/mllp-sink-source.citrus.it.yaml | 142 +++++++++++++++++++++
.../src/test/resources/mllp/mllp-source-route.yaml | 45 +++++++
11 files changed, 880 insertions(+), 1 deletion(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index b26b9c955..7410e6ec2 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -731,6 +731,16 @@
"type" : "library",
"name" : "message-timestamp-router-action",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:mllp-sink",
+ "type" : "library",
+ "name" : "mllp-sink",
+ "version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:mllp-source",
+ "type" : "library",
+ "name" : "mllp-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:mongodb-changes-stream-source",
"type" : "library",
@@ -1915,6 +1925,17 @@
"name" : "camel.apache.org/versioned-by",
"value" : "runtime"
} ]
+ }, {
+ "bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.camel",
+ "name" : "camel-mllp",
+ "version" : "4.24.0-SNAPSHOT",
+ "purl" : "pkg:maven/org.apache.camel/[email protected]",
+ "properties" : [ {
+ "name" : "camel.apache.org/versioned-by",
+ "value" : "runtime"
+ } ]
}, {
"bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
"type" : "library",
@@ -2287,7 +2308,7 @@
} ],
"dependencies" : [ {
"ref" : "camel-kamelets-catalog",
- "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-kinesis-firehose-sink",
"kamelet:aws-kinesis-sink", "kamelet:aws-kinesis- [...]
+ "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-kinesis-firehose-sink",
"kamelet:aws-kinesis-sink", "kamelet:aws-kinesis- [...]
}, {
"ref" : "kamelet:avro-deserialize-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2720,6 +2741,12 @@
}, {
"ref" : "kamelet:message-timestamp-router-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:mllp-sink",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:mllp-source",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:mongodb-changes-stream-source",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -3170,6 +3197,9 @@
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 112b5c9cd..c0eb7bf74 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -143,6 +143,8 @@
* xref:mariadb-source.adoc[]
* xref:mask-field-action.adoc[]
* xref:message-timestamp-router-action.adoc[]
+* xref:mllp-sink.adoc[]
+* xref:mllp-source.adoc[]
* xref:mongodb-changes-stream-source.adoc[]
* xref:mongodb-sink.adoc[]
* xref:mongodb-source.adoc[]
diff --git a/kamelets/mllp-sink.kamelet.yaml b/kamelets/mllp-sink.kamelet.yaml
new file mode 100644
index 000000000..d36fc74fa
--- /dev/null
+++ b/kamelets/mllp-sink.kamelet.yaml
@@ -0,0 +1,116 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: mllp-sink
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHJlY3QgeD0iNCIgeT0iNCIgd2lkdGg9IjU2IiBoZWlnaHQ9IjU2IiByeD0iMTAiIGZpbGw9IiMyYTdhYjAiLz48cGF0aCBkPSJNMjYgMTRoMTJ2MTJoMTJ2MTJIMzh2MTJIMjZWMzhIMTRWMjZoMTJ6IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "MLLP"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "sink"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "MLLP Sink"
+ description: |-
+ Sends each message as an HL7 v2 message to a hospital system over MLLP,
a plain TCP connection, and waits for its HL7 acknowledgement (ACK).
+
+ Use it to send admissions, orders or results to a hospital information
system, a lab system or an interface engine that receives HL7 v2 over MLLP, or
to forward the messages that `mllp-source` receives. To write FHIR resources
instead, use `fhir-sink`.
+
+ Input: the body is the HL7 message, as text with its segments separated
by a carriage return (`\r`), or as bytes, which are sent as they are. Text is
sent in `charset`, which is ISO-8859-1 when it is not set: set it to the
charset that the MSH-18 field of the messages names, such as `UTF-8` for
`UNICODE UTF-8`, because it is not read from the message.
+
+ Output: when it is used inside a route, the body is unchanged
afterwards. `CamelMllpAcknowledgementType` is the code of the acknowledgement,
`AA` when the receiver accepted the message, `CamelMllpAcknowledgementString`
the acknowledgement as text, and `CamelMllpAcknowledgement` the same as bytes.
+
+ Good to know: an acknowledgement `AE` (error) or `AR` (rejected) fails
the message, and `CamelMllpAcknowledgementType` and
`CamelMllpAcknowledgementString` are still set, so that a step that handles the
error can read the reason in the MSA-3 field. A receiver that cannot be
reached, or that does not answer within `ackTimeout`, fails the message. It
connects at the first message and keeps the connection open for the next ones.
It connects with no TLS. For TLS, set the application pr [...]
+ required:
+ - host
+ - port
+ type: object
+ properties:
+ host:
+ title: Host
+ description: The host name or IP address of the system to send the
messages to.
+ type: string
+ example: "hl7.hospital.example.com"
+ pattern: "^[A-Za-z0-9._:-]+$"
+ port:
+ title: Port
+ description: The TCP port that the system listens on for MLLP, often
2575.
+ type: integer
+ example: 2575
+ charset:
+ title: Charset
+ description: The charset to send text in, such as `UTF-8`. Set it to
the charset that MSH-18 of the messages names; it is not read from the message.
It is also used to read the acknowledgement when its MSH-18 is empty.
+ type: string
+ default: ISO-8859-1
+ example: UTF-8
+ pattern: "^[A-Za-z0-9._:-]+$"
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection to the system, in
milliseconds. When it is not set, it is 30000 (30 seconds).
+ type: integer
+ example: 5000
+ ackTimeout:
+ title: Acknowledgement Timeout
+ description: How long to wait for the acknowledgement of a message, in
milliseconds. When it is not set, it is 15000 (15 seconds).
+ type: integer
+ example: 30000
+ dataTypes:
+ # No 'default:' here on purpose: the body is sent as it is, text or bytes.
See #3117.
+ in:
+ headers: {}
+ out:
+ headers:
+ CamelMllpAcknowledgementType:
+ title: Acknowledgement Type
+ description: The code of the acknowledgement, `AA` (accepted), `AE`
(error) or `AR` (rejected).
+ type: string
+ CamelMllpAcknowledgementString:
+ title: Acknowledgement
+ description: The acknowledgement the receiver sent, as text, with
its MSH and MSA segments.
+ type: string
+ dependencies:
+ - "camel:mllp"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: kamelet:source
+ steps:
+ - removeHeaders:
+ pattern: CamelMllpAcknowledgement*
+ # The charset of the text is `charset`: a CamelCharsetName header or
exchange property, which
+ # the MLLP component reads first and which mllp-source and earlier
MLLP sends set, would win.
+ - removeHeader:
+ name: CamelCharsetName
+ - setProperty:
+ name: CamelCharsetName
+ expression:
+ constant:
+ expression: "{{charset}}"
+ - to:
+ uri: mllp
+ parameters:
+ hostname: "{{host}}"
+ port: "{{port}}"
+ charsetName: "{{charset}}"
+ connectTimeout: "{{?connectTimeout}}"
+ receiveTimeout: "{{?ackTimeout}}"
diff --git a/kamelets/mllp-source.kamelet.yaml
b/kamelets/mllp-source.kamelet.yaml
new file mode 100644
index 000000000..9953e2062
--- /dev/null
+++ b/kamelets/mllp-source.kamelet.yaml
@@ -0,0 +1,133 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: mllp-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHJlY3QgeD0iNCIgeT0iNCIgd2lkdGg9IjU2IiBoZWlnaHQ9IjU2IiByeD0iMTAiIGZpbGw9IiMyYTdhYjAiLz48cGF0aCBkPSJNMjYgMTRoMTJ2MTJoMTJ2MTJIMzh2MTJIMjZWMzhIMTRWMjZoMTJ6IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "MLLP"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "MLLP Source"
+ description: |-
+ Receives HL7 v2 messages, such as admissions (ADT) or lab results (ORU),
that hospital systems send over MLLP, a plain TCP connection, and acknowledges
each one.
+
+ Use it to receive the HL7 v2 feed of a hospital information system, a
lab system or an interface engine, for example to store the messages, or to
turn them into FHIR resources for `fhir-sink`. To send HL7 v2 messages, use
`mllp-sink`.
+
+ Output: the body is the HL7 message, as text, with its segments
separated by a carriage return (`\r`). The text is read in the charset that the
MSH-18 field of the message names, such as `UNICODE UTF-8`, or in `charset`
when MSH-18 is empty. Headers give the fields of the MSH segment:
`CamelMllpMessageType` (MSH-9, such as `ADT^A01`), split into
`CamelMllpEventType` (`ADT`) and `CamelMllpTriggerEvent` (`A01`),
`CamelMllpMessageControlId` (MSH-10), `CamelMllpSendingApplication` and [...]
+
+ Good to know: it answers each message with an HL7 acknowledgement (ACK)
once the rest of the flow has processed it, and the sender waits for it: `AA`
(accepted), or `AE` (error) when a step of the flow fails, with the name of the
error in the MSA-3 field. A message without a complete MSH segment still
reaches the flow, but gets no acknowledgement. It listens on all the network
interfaces of the machine unless `host` says otherwise, with no login and no
TLS, so anyone who can reach [...]
+ required:
+ - port
+ type: object
+ properties:
+ port:
+ title: Port
+ description: The TCP port to listen on for the connections of the
sending systems. 2575 is the port registered for HL7 over MLLP. A port below
1024 needs administrator rights on most systems.
+ type: integer
+ example: 2575
+ host:
+ title: Host
+ description: The local address to listen on. The default, `0.0.0.0`,
accepts connections on all the network interfaces of the machine; `127.0.0.1`
accepts only connections from the same machine.
+ type: string
+ default: "0.0.0.0"
+ example: "127.0.0.1"
+ pattern: "^[A-Za-z0-9._:-]+$"
+ charset:
+ title: Charset
+ description: The charset to read the text of a message in when its
MSH-18 field is empty, such as `UTF-8`. When it is not set, it is ISO-8859-1. A
message whose MSH-18 names a charset, such as `UNICODE UTF-8` or `8859/1`, is
read in that charset.
+ type: string
+ example: UTF-8
+ pattern: "^[A-Za-z0-9._:-]+$"
+ dataTypes:
+ # No 'default:' here on purpose: a source output type is applied only
after the flow has run (see
+ # #3117), and the body is already text.
+ out:
+ headers:
+ CamelMllpMessageType:
+ title: Message Type
+ description: The message type, from MSH-9, such as `ADT^A01`.
+ type: string
+ CamelMllpEventType:
+ title: Event Type
+ description: The first part of the message type, such as `ADT`.
+ type: string
+ CamelMllpTriggerEvent:
+ title: Trigger Event
+ description: The second part of the message type, the trigger event,
such as `A01`.
+ type: string
+ CamelMllpMessageControlId:
+ title: Message Control ID
+ description: The ID the sender gave the message, from MSH-10. The
acknowledgement repeats it.
+ type: string
+ CamelMllpSendingApplication:
+ title: Sending Application
+ description: The application that sent the message, from MSH-3.
+ type: string
+ CamelMllpSendingFacility:
+ title: Sending Facility
+ description: The facility that sent the message, from MSH-4.
+ type: string
+ CamelMllpReceivingApplication:
+ title: Receiving Application
+ description: The application the message is for, from MSH-5.
+ type: string
+ CamelMllpReceivingFacility:
+ title: Receiving Facility
+ description: The facility the message is for, from MSH-6.
+ type: string
+ CamelMllpTimestamp:
+ title: Timestamp
+ description: The time the message was created, from MSH-7, such as
`20260101120000`.
+ type: string
+ CamelMllpProcessingId:
+ title: Processing ID
+ description: The processing ID, from MSH-11, such as `P` for
production or `T` for test.
+ type: string
+ CamelMllpVersionId:
+ title: Version ID
+ description: The HL7 version of the message, from MSH-12, such as
`2.5`.
+ type: string
+ CamelMllpRemoteAddress:
+ title: Remote Address
+ description: The address and port of the sender, such as
`/10.0.0.5:51234`.
+ type: string
+ dependencies:
+ - "camel:mllp"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: mllp
+ parameters:
+ hostname: "{{host}}"
+ port: "{{port}}"
+ charsetName: "{{?charset}}"
+ steps:
+ # The component marks the message with its charset (ISO-8859-1 by
default), which would then
+ # turn the text into bytes in that charset in the later steps,
whatever MSH-18 says.
+ - removeProperty:
+ name: CamelCharsetName
+ - to:
+ uri: kamelet:sink
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 01bb20cc5..0cc477b4b 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -1439,6 +1439,26 @@
"group" : "Actions",
"namespace" : "Kafka",
"provider" : "Apache Software Foundation"
+ }, {
+ "name" : "mllp-sink",
+ "type" : "sink",
+ "supportLevel" : "Stable",
+ "title" : "MLLP Sink",
+ "summary" : "Sends each message as an HL7 v2 message to a hospital system
over MLLP, a plain TCP connection, and waits for its HL7 acknowledgement
(ACK).",
+ "description" : "Sends each message as an HL7 v2 message to a hospital
system over MLLP, a plain TCP connection, and waits for its HL7 acknowledgement
(ACK).\n\nUse it to send admissions, orders or results to a hospital
information system, a lab system or an interface engine that receives HL7 v2
over MLLP, or to forward the messages that `mllp-source` receives. To write
FHIR resources instead, use `fhir-sink`.\n\nInput: the body is the HL7 message,
as text with its segments separated [...]
+ "group" : "MLLP",
+ "namespace" : "Messaging",
+ "provider" : "Apache Software Foundation"
+ }, {
+ "name" : "mllp-source",
+ "type" : "source",
+ "supportLevel" : "Stable",
+ "title" : "MLLP Source",
+ "summary" : "Receives HL7 v2 messages, such as admissions (ADT) or lab
results (ORU), that hospital systems send over MLLP, a plain TCP connection,
and acknowledges each one.",
+ "description" : "Receives HL7 v2 messages, such as admissions (ADT) or lab
results (ORU), that hospital systems send over MLLP, a plain TCP connection,
and acknowledges each one.\n\nUse it to receive the HL7 v2 feed of a hospital
information system, a lab system or an interface engine, for example to store
the messages, or to turn them into FHIR resources for `fhir-sink`. To send HL7
v2 messages, use `mllp-sink`.\n\nOutput: the body is the HL7 message, as text,
with its segments sepa [...]
+ "group" : "MLLP",
+ "namespace" : "Messaging",
+ "provider" : "Apache Software Foundation"
}, {
"name" : "mongodb-changes-stream-source",
"type" : "source",
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/mllp-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/mllp-sink.kamelet.yaml
new file mode 100644
index 000000000..d36fc74fa
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/mllp-sink.kamelet.yaml
@@ -0,0 +1,116 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: mllp-sink
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHJlY3QgeD0iNCIgeT0iNCIgd2lkdGg9IjU2IiBoZWlnaHQ9IjU2IiByeD0iMTAiIGZpbGw9IiMyYTdhYjAiLz48cGF0aCBkPSJNMjYgMTRoMTJ2MTJoMTJ2MTJIMzh2MTJIMjZWMzhIMTRWMjZoMTJ6IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "MLLP"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "sink"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "MLLP Sink"
+ description: |-
+ Sends each message as an HL7 v2 message to a hospital system over MLLP,
a plain TCP connection, and waits for its HL7 acknowledgement (ACK).
+
+ Use it to send admissions, orders or results to a hospital information
system, a lab system or an interface engine that receives HL7 v2 over MLLP, or
to forward the messages that `mllp-source` receives. To write FHIR resources
instead, use `fhir-sink`.
+
+ Input: the body is the HL7 message, as text with its segments separated
by a carriage return (`\r`), or as bytes, which are sent as they are. Text is
sent in `charset`, which is ISO-8859-1 when it is not set: set it to the
charset that the MSH-18 field of the messages names, such as `UTF-8` for
`UNICODE UTF-8`, because it is not read from the message.
+
+ Output: when it is used inside a route, the body is unchanged
afterwards. `CamelMllpAcknowledgementType` is the code of the acknowledgement,
`AA` when the receiver accepted the message, `CamelMllpAcknowledgementString`
the acknowledgement as text, and `CamelMllpAcknowledgement` the same as bytes.
+
+ Good to know: an acknowledgement `AE` (error) or `AR` (rejected) fails
the message, and `CamelMllpAcknowledgementType` and
`CamelMllpAcknowledgementString` are still set, so that a step that handles the
error can read the reason in the MSA-3 field. A receiver that cannot be
reached, or that does not answer within `ackTimeout`, fails the message. It
connects at the first message and keeps the connection open for the next ones.
It connects with no TLS. For TLS, set the application pr [...]
+ required:
+ - host
+ - port
+ type: object
+ properties:
+ host:
+ title: Host
+ description: The host name or IP address of the system to send the
messages to.
+ type: string
+ example: "hl7.hospital.example.com"
+ pattern: "^[A-Za-z0-9._:-]+$"
+ port:
+ title: Port
+ description: The TCP port that the system listens on for MLLP, often
2575.
+ type: integer
+ example: 2575
+ charset:
+ title: Charset
+ description: The charset to send text in, such as `UTF-8`. Set it to
the charset that MSH-18 of the messages names; it is not read from the message.
It is also used to read the acknowledgement when its MSH-18 is empty.
+ type: string
+ default: ISO-8859-1
+ example: UTF-8
+ pattern: "^[A-Za-z0-9._:-]+$"
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection to the system, in
milliseconds. When it is not set, it is 30000 (30 seconds).
+ type: integer
+ example: 5000
+ ackTimeout:
+ title: Acknowledgement Timeout
+ description: How long to wait for the acknowledgement of a message, in
milliseconds. When it is not set, it is 15000 (15 seconds).
+ type: integer
+ example: 30000
+ dataTypes:
+ # No 'default:' here on purpose: the body is sent as it is, text or bytes.
See #3117.
+ in:
+ headers: {}
+ out:
+ headers:
+ CamelMllpAcknowledgementType:
+ title: Acknowledgement Type
+ description: The code of the acknowledgement, `AA` (accepted), `AE`
(error) or `AR` (rejected).
+ type: string
+ CamelMllpAcknowledgementString:
+ title: Acknowledgement
+ description: The acknowledgement the receiver sent, as text, with
its MSH and MSA segments.
+ type: string
+ dependencies:
+ - "camel:mllp"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: kamelet:source
+ steps:
+ - removeHeaders:
+ pattern: CamelMllpAcknowledgement*
+ # The charset of the text is `charset`: a CamelCharsetName header or
exchange property, which
+ # the MLLP component reads first and which mllp-source and earlier
MLLP sends set, would win.
+ - removeHeader:
+ name: CamelCharsetName
+ - setProperty:
+ name: CamelCharsetName
+ expression:
+ constant:
+ expression: "{{charset}}"
+ - to:
+ uri: mllp
+ parameters:
+ hostname: "{{host}}"
+ port: "{{port}}"
+ charsetName: "{{charset}}"
+ connectTimeout: "{{?connectTimeout}}"
+ receiveTimeout: "{{?ackTimeout}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/mllp-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/mllp-source.kamelet.yaml
new file mode 100644
index 000000000..9953e2062
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/mllp-source.kamelet.yaml
@@ -0,0 +1,133 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: mllp-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHJlY3QgeD0iNCIgeT0iNCIgd2lkdGg9IjU2IiBoZWlnaHQ9IjU2IiByeD0iMTAiIGZpbGw9IiMyYTdhYjAiLz48cGF0aCBkPSJNMjYgMTRoMTJ2MTJoMTJ2MTJIMzh2MTJIMjZWMzhIMTRWMjZoMTJ6IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "MLLP"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "MLLP Source"
+ description: |-
+ Receives HL7 v2 messages, such as admissions (ADT) or lab results (ORU),
that hospital systems send over MLLP, a plain TCP connection, and acknowledges
each one.
+
+ Use it to receive the HL7 v2 feed of a hospital information system, a
lab system or an interface engine, for example to store the messages, or to
turn them into FHIR resources for `fhir-sink`. To send HL7 v2 messages, use
`mllp-sink`.
+
+ Output: the body is the HL7 message, as text, with its segments
separated by a carriage return (`\r`). The text is read in the charset that the
MSH-18 field of the message names, such as `UNICODE UTF-8`, or in `charset`
when MSH-18 is empty. Headers give the fields of the MSH segment:
`CamelMllpMessageType` (MSH-9, such as `ADT^A01`), split into
`CamelMllpEventType` (`ADT`) and `CamelMllpTriggerEvent` (`A01`),
`CamelMllpMessageControlId` (MSH-10), `CamelMllpSendingApplication` and [...]
+
+ Good to know: it answers each message with an HL7 acknowledgement (ACK)
once the rest of the flow has processed it, and the sender waits for it: `AA`
(accepted), or `AE` (error) when a step of the flow fails, with the name of the
error in the MSA-3 field. A message without a complete MSH segment still
reaches the flow, but gets no acknowledgement. It listens on all the network
interfaces of the machine unless `host` says otherwise, with no login and no
TLS, so anyone who can reach [...]
+ required:
+ - port
+ type: object
+ properties:
+ port:
+ title: Port
+ description: The TCP port to listen on for the connections of the
sending systems. 2575 is the port registered for HL7 over MLLP. A port below
1024 needs administrator rights on most systems.
+ type: integer
+ example: 2575
+ host:
+ title: Host
+ description: The local address to listen on. The default, `0.0.0.0`,
accepts connections on all the network interfaces of the machine; `127.0.0.1`
accepts only connections from the same machine.
+ type: string
+ default: "0.0.0.0"
+ example: "127.0.0.1"
+ pattern: "^[A-Za-z0-9._:-]+$"
+ charset:
+ title: Charset
+ description: The charset to read the text of a message in when its
MSH-18 field is empty, such as `UTF-8`. When it is not set, it is ISO-8859-1. A
message whose MSH-18 names a charset, such as `UNICODE UTF-8` or `8859/1`, is
read in that charset.
+ type: string
+ example: UTF-8
+ pattern: "^[A-Za-z0-9._:-]+$"
+ dataTypes:
+ # No 'default:' here on purpose: a source output type is applied only
after the flow has run (see
+ # #3117), and the body is already text.
+ out:
+ headers:
+ CamelMllpMessageType:
+ title: Message Type
+ description: The message type, from MSH-9, such as `ADT^A01`.
+ type: string
+ CamelMllpEventType:
+ title: Event Type
+ description: The first part of the message type, such as `ADT`.
+ type: string
+ CamelMllpTriggerEvent:
+ title: Trigger Event
+ description: The second part of the message type, the trigger event,
such as `A01`.
+ type: string
+ CamelMllpMessageControlId:
+ title: Message Control ID
+ description: The ID the sender gave the message, from MSH-10. The
acknowledgement repeats it.
+ type: string
+ CamelMllpSendingApplication:
+ title: Sending Application
+ description: The application that sent the message, from MSH-3.
+ type: string
+ CamelMllpSendingFacility:
+ title: Sending Facility
+ description: The facility that sent the message, from MSH-4.
+ type: string
+ CamelMllpReceivingApplication:
+ title: Receiving Application
+ description: The application the message is for, from MSH-5.
+ type: string
+ CamelMllpReceivingFacility:
+ title: Receiving Facility
+ description: The facility the message is for, from MSH-6.
+ type: string
+ CamelMllpTimestamp:
+ title: Timestamp
+ description: The time the message was created, from MSH-7, such as
`20260101120000`.
+ type: string
+ CamelMllpProcessingId:
+ title: Processing ID
+ description: The processing ID, from MSH-11, such as `P` for
production or `T` for test.
+ type: string
+ CamelMllpVersionId:
+ title: Version ID
+ description: The HL7 version of the message, from MSH-12, such as
`2.5`.
+ type: string
+ CamelMllpRemoteAddress:
+ title: Remote Address
+ description: The address and port of the sender, such as
`/10.0.0.5:51234`.
+ type: string
+ dependencies:
+ - "camel:mllp"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: mllp
+ parameters:
+ hostname: "{{host}}"
+ port: "{{port}}"
+ charsetName: "{{?charset}}"
+ steps:
+ # The component marks the message with its charset (ISO-8859-1 by
default), which would then
+ # turn the text into bytes in that charset in the later steps,
whatever MSH-18 says.
+ - removeProperty:
+ name: CamelCharsetName
+ - to:
+ uri: kamelet:sink
diff --git a/tests/camel-kamelets-itest/src/test/java/MllpIT.java
b/tests/camel-kamelets-itest/src/test/java/MllpIT.java
new file mode 100644
index 000000000..6be201718
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/java/MllpIT.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+import java.util.stream.Stream;
+
+import org.citrusframework.api.common.TestLoader;
+import org.citrusframework.container.SequenceBeforeTest;
+import org.citrusframework.junit.jupiter.CitrusSupport;
+import org.citrusframework.junit.jupiter.CitrusTestFactory;
+import org.citrusframework.junit.jupiter.CitrusTestFactorySupport;
+import org.citrusframework.spi.BindToRegistry;
+import org.junit.jupiter.api.DynamicTest;
+
+import static
org.citrusframework.actions.CreateVariablesAction.Builder.createVariables;
+
+/**
+ * Tests of the MLLP Kamelets (HL7 v2 over MLLP): mllp-sink sends to
mllp-source in another integration, so no
+ * container is needed.
+ */
+@CitrusSupport
+public class MllpIT {
+
+ private final int mllpPort = ServerPorts.next();
+
+ @BindToRegistry
+ public SequenceBeforeTest beforeMllp() {
+ return new SequenceBeforeTest.Builder().onTests("mllp-*").actions(
+ createVariables().variable("mllp.port",
String.valueOf(mllpPort))
+ ).build();
+ }
+
+ @CitrusTestFactory
+ public Stream<DynamicTest> mllp() {
+ return
CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("mllp");
+ }
+}
diff --git
a/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-route.yaml
new file mode 100644
index 000000000..ccd5624d1
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-route.yaml
@@ -0,0 +1,92 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+# Sends HL7 messages to mllp-source-route, and logs the body and the
acknowledgement after each one
+- route:
+ from:
+ uri: "timer:hl7"
+ parameters:
+ repeatCount: 1
+ steps:
+ # An admission, as text
+ - setBody:
+ constant:
"MSH|^~\\&|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A01|MSG00001|P|2.5\rPID|1||12345||Doe^John"
+ - to:
+ uri: "kamelet:mllp-sink"
+ parameters:
+ host: "localhost"
+ port: "{{mllp.port}}"
+ - log: "Sent MSG00001 ${body.getClass().getName()}:
${body.replace('\r', ' / ')}|"
+ - log: "Ack MSG00001 ${header.CamelMllpAcknowledgementType}
${header.CamelMllpAcknowledgement.getClass().getName()}:
${header.CamelMllpAcknowledgementString.replace('\r', ' / ')}|"
+ # In UTF-8, as MSH-18 says; a CamelCharsetName header does not change
it
+ - setBody:
+ constant:
"MSH|^~\\&|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A08|MSG00002|P|2.5||||||UNICODE
UTF-8\rPID|1||12345||Sørensen^Łucja"
+ - setHeader:
+ name: "CamelCharsetName"
+ constant: "UTF-16"
+ - to:
+ uri: "kamelet:mllp-sink"
+ parameters:
+ host: "localhost"
+ port: "{{mllp.port}}"
+ charset: "UTF-8"
+ - log: "Ack MSG00002 ${header.CamelMllpAcknowledgementType}"
+ - removeHeader:
+ name: "CamelCharsetName"
+ # As bytes
+ - setBody:
+ constant:
"MSH|^~\\&|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A04|MSG00003|P|2.5\rPID|1||12345||Doe^John"
+ - convertBodyTo:
+ type: "byte[]"
+ - to:
+ uri: "kamelet:mllp-sink"
+ parameters:
+ host: "localhost"
+ port: "{{mllp.port}}"
+ - log: "Ack MSG00003 ${header.CamelMllpAcknowledgementType}
body=${body.getClass().getName()}"
+ # The flow of the source fails: AE
+ - setBody:
+ constant:
"MSH|^~\\&|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A99|MSG00004|P|2.5\rPID|1||12345||Doe^John"
+ - doTry:
+ steps:
+ - to:
+ uri: "kamelet:mllp-sink"
+ parameters:
+ host: "localhost"
+ port: "{{mllp.port}}"
+ - log: "Accepted MSG00004 ${header.CamelMllpAcknowledgementType}"
+ doCatch:
+ - exception:
+ - "java.lang.Exception"
+ steps:
+ - log: "Rejected MSG00004 ${exception.getClass().getName()}
${header.CamelMllpAcknowledgementType}:
${header.CamelMllpAcknowledgementString.replace('\r', ' / ')}|"
+ # The flow of the source rejects the message: AR
+ - setBody:
+ constant:
"MSH|^~\\&|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A98|MSG00005|P|2.5\rPID|1||12345||Doe^John"
+ - doTry:
+ steps:
+ - to:
+ uri: "kamelet:mllp-sink"
+ parameters:
+ host: "localhost"
+ port: "{{mllp.port}}"
+ - log: "Accepted MSG00005 ${header.CamelMllpAcknowledgementType}"
+ doCatch:
+ - exception:
+ - "java.lang.Exception"
+ steps:
+ - log: "Rejected MSG00005 ${exception.getClass().getName()}
${header.CamelMllpAcknowledgementType}:
${header.CamelMllpAcknowledgementString.replace('\r', ' / ')}|"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-source.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-source.citrus.it.yaml
new file mode 100644
index 000000000..571d1ea37
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-sink-source.citrus.it.yaml
@@ -0,0 +1,142 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: mllp-sink-source-test
+description: 'mllp-sink sends HL7 v2 messages to mllp-source, which gives each
one to its flow and acknowledges it: AA, AE when the flow fails, AR when the
flow rejects it'
+actions:
+ # The source listens on all the network interfaces
+ - camel:
+ cli:
+ run:
+ integration:
+ file: "mllp/mllp-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "mllp.port"
+ value: "${mllp.port}"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "ServerSocket[addr=/0.0.0.0,localport=${mllp.port}]"
+
+ - camel:
+ cli:
+ run:
+ integration:
+ file: "mllp/mllp-sink-route.yaml"
+ systemProperties:
+ properties:
+ - name: "mllp.port"
+ value: "${mllp.port}"
+
+ # The source gives the message as text, with the fields of the MSH segment
in headers
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage:
"|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A01|MSG00001|P|2.5 /
PID|1||12345||Doe^John|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "Received MSG00001 java.lang.String: MSH|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "Headers MSG00001 type=ADT^A01 event=ADT trigger=A01
from=SENDER/HOSPITAL to=RECEIVER/LAB time=20260101120000 processing=P
version=2.5 remote=/127.0.0.1:"
+
+ # The sink leaves the body as it is, and gives the AA acknowledgement of the
source
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Sent MSG00001 java.lang.String: MSH|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage:
"|SENDER|HOSPITAL|RECEIVER|LAB|20260101120000||ADT^A01|MSG00001|P|2.5 /
PID|1||12345||Doe^John|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Ack MSG00001 AA [B: MSH|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "|RECEIVER|LAB|SENDER|HOSPITAL|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "||ACK^A01|MSG00001A|P|2.5 / MSA|AA|MSG00001 / |"
+
+ # UTF-8 text, as MSH-18 says, whatever the CamelCharsetName header says;
turned into bytes in UTF-8 afterwards
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "Name MSG00002 true"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "Bytes MSG00002 126"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Ack MSG00002 AA"
+
+ # A body of bytes is sent as it is
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-source-route"
+ logMessage: "Headers MSG00003 type=ADT^A04"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Ack MSG00003 AA body=[B"
+
+ # The flow of the source fails: AE, with the name of the error in MSA-3,
fails the message in the sink
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Rejected MSG00004
org.apache.camel.component.mllp.MllpApplicationErrorAcknowledgementException
AE: MSH|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "MSA|AE|MSG00004|java.lang.IllegalArgumentException / |"
+
+ # The flow of the source rejects the message: AR fails the message in the
sink
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "Rejected MSG00005
org.apache.camel.component.mllp.MllpApplicationRejectAcknowledgementException
AR: MSH|"
+ - camel:
+ cli:
+ verify:
+ integration: "mllp-sink-route"
+ logMessage: "MSA|AR|MSG00005 / |"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-source-route.yaml
new file mode 100644
index 000000000..104157e35
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/mllp/mllp-source-route.yaml
@@ -0,0 +1,45 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+# Receives the HL7 messages that mllp-sink-route sends, and logs the body and
the headers of each one
+- route:
+ from:
+ uri: "kamelet:mllp-source"
+ parameters:
+ port: "{{mllp.port}}"
+ steps:
+ - log: "Received ${header.CamelMllpMessageControlId}
${body.getClass().getName()}: ${body.replace('\r', ' / ')}|"
+ - log: "Headers ${header.CamelMllpMessageControlId}
type=${header.CamelMllpMessageType} event=${header.CamelMllpEventType}
trigger=${header.CamelMllpTriggerEvent}
from=${header.CamelMllpSendingApplication}/${header.CamelMllpSendingFacility}
to=${header.CamelMllpReceivingApplication}/${header.CamelMllpReceivingFacility}
time=${header.CamelMllpTimestamp} processing=${header.CamelMllpProcessingId}
version=${header.CamelMllpVersionId} remote=${header.CamelMllpRemoteAddress}"
+ # Read in the charset of MSH-18, and turned into bytes in UTF-8
afterwards (Sørensen and Łucja are 2 bytes longer)
+ - log: "Name ${header.CamelMllpMessageControlId}
${body.contains('Sørensen^Łucja')}"
+ - convertBodyTo:
+ type: "byte[]"
+ - log: "Bytes ${header.CamelMllpMessageControlId} ${body.length}"
+ # A step that fails: the sender gets an AE acknowledgement
+ - filter:
+ simple: "${header.CamelMllpTriggerEvent} == 'A99'"
+ steps:
+ - throwException:
+ exceptionType: "java.lang.IllegalArgumentException"
+ message: "Unknown trigger event A99"
+ # The flow rejects the message: the sender gets an AR acknowledgement
+ - filter:
+ simple: "${header.CamelMllpTriggerEvent} == 'A98'"
+ steps:
+ - setProperty:
+ name: "CamelMllpAcknowledgementType"
+ constant: "AR"