Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CAMEL-805

HL7 DataFormat

This component ships with a HL7 dataformat 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
java
java

  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:

Code Block
java
java

  DataFormat hl7 = new HL7DataFormat();
  ...
  from("jms:queue:hl7out").unmarshal(hl7).to("patientLookupService");

Here we unmarshal the byte stream into a HAPI Message object that is passed to our patient lookup service.

Notice: Since Camel has build in type converters the DataFormat isn't in much need. However they are there if you need them, for instance if it makes the routing much clearer. TODO: Move from the HL7 component here