...
marshal
= from Message to byte stream (can be used when returning as response responding using the HL7 MLLP codec)unmarshal
= from byte stream to Message (can be used when receiving streamed data from the HL7 MLLP
...
Here we unmarshal the byte stream into a HAPI Message object that is passed to our patient lookup service.
Tip |
---|
title | Serializable messages |
---|
|
As of HAPI 2.0 (used by Camel 2.11), the HL7v2 model classes are fully serializable. So you can put HL7v2 messages directly into a JMS queue (i.e. without calling marshal() and read them again directly from the queue (i.e. without calling unmarshal() . |
Note |
---|
|
As of Camel 2.11, unmarshal does not automatically fix segment separators anymore by converting \n to \r . If you need this conversion, org.apache.camel.component.hl7.HL7#convertLFToCR provides a handy Expression for this purpose. |
Note |
---|
|
As of Camel 2.14.1, both marshal and unmarshal consider evaluate the charset provided in the field MSH-18 . If this field is empty, by default the charset contained in the corresponding Camel charset property/header is assumed. You can even change this default behavior by overriding the guessCharsetName method when inheriting from the HL7DataFormat class. |
Notice there There is a shorthand syntax in Camel for well-known data formats that is are 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");
|
Tip |
---|
title | Serializable messages |
---|
|
As of HAPI 2.0 (used by Camel 2.11), the HL7v2 model classes are fully serializable. So you can put HL7v2 messages directly into a JMS queue (i.e. without calling marshal()
and read them again directly from the queue (i.e. without calling unmarshal()
.