Class HL7MessageConverter

java.lang.Object
org.openehealth.ipf.platform.camel.hl7.converter.HL7MessageConverter
All Implemented Interfaces:
MessageConverter

public class HL7MessageConverter extends Object implements MessageConverter
HL7MessageConverter helps serializing a HL7 message to and from a string for the purpose of routing it through a JMS queue. The same converter should be used on consumer and producer side.

HAPI HL7 message objects have a reference to a transient parser, which in return has the reference to the valid HapiContext. After deserialization, the context and parser references have to be re-established.

Currently, this class accepts String and HAPI message objects only. Deserialization will always produce a HAPI Message object.

  • Constructor Details

    • HL7MessageConverter

      public HL7MessageConverter(HapiContext hapiContext)
  • Method Details

    • toMessage

      @NonNull public @NonNull jakarta.jms.Message toMessage(@NonNull @NonNull Object o, @NonNull @NonNull jakarta.jms.Session session) throws jakarta.jms.JMSException, MessageConversionException
      Returns a TextMessage instance containing the HL7 message as string
      Specified by:
      toMessage in interface MessageConverter
      Parameters:
      o - incoming object, can be either String or Message
      session - JMS session
      Returns:
      a TextMessage instance containing the HL7 message as string
      Throws:
      jakarta.jms.JMSException
      MessageConversionException
    • fromMessage

      public Object fromMessage(@NonNull @NonNull jakarta.jms.Message message) throws jakarta.jms.JMSException, MessageConversionException
      Returns a Message built from the JMS message type, using the specified HapiContext
      Specified by:
      fromMessage in interface MessageConverter
      Parameters:
      message - JMS ObjectMessage or TextMessage
      Returns:
      a Message built from the JMS message type
      Throws:
      jakarta.jms.JMSException
      MessageConversionException