...
The HL7 component ships with a HL7 dataformat data format that can be used to format between String
and HL7 model objects.
marshal
= from Message to byte stream (can be used when returning as response using the HL7 MLLP codec)unmarshal
= from byte stream to Message (can be used when receiving streamed data from the HL7 MLLP
To use the data format, simply instantiate an instance and invoke the marhsal or unmarshl operation in the route builder:
Code Block | ||||
---|---|---|---|---|
| ||||
DataFormat hl7 = new HL7DataFormat(); ... from("direct:hl7in").marshal(hl7).to("jms:queue:hl7out"); |
In the sample above, the HL7 is marshalled from a HAPI Message object to a byte stream and put on a JMS queue.
The next example is the opposite:
...
Notice there is a shorthand syntax in Camel for well-known data formats that is commonly used.
Then you don't need to create an instance of the HL7DataFormat
object:
Code Block | ||||
---|---|---|---|---|
| ||||
from("direct:hl7in").marshal().hl7().to("jms:queue:hl7out"); from("jms:queue:hl7out").unmarshal().hl7().to("patientLookupService"); |
...
Camel 1.x
Key | MSH field | Example |
---|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
Camel 2.0
Key | MSH field | Example |
---|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
All headers are String
types. If a header value is missing, its value is null
.
Dependencies
To use HL7 in your camel routes you need to add the a dependency on camel-hl7, which implements this data format.
If you use maven Maven, you could just add the following to your pom.xml
, substituting the version number for the latest & greatest release (see the download page for the latest versions).
...