2

I am using Apache Camel, Mina2 and HAPI to receive HL7 v2 messages. I noticed that its taking lot of time to unmarshal and create Message object. And this time increases when I have larger message.

My message has around 120 OBX segment and I am using OBX 3 and OBX 5 field only. I tested manually removing fields after OBX 5 and found some improvement in performance. Is there any way to tell HAPI not to parse any fields after OBX 5 ?

anupsth
  • 657
  • 1
  • 6
  • 18

1 Answers1

0

You could extend ca.uhn.hl7v2.parser.PipeParser and override the Segment parsing method.

@Override
public void parse(Segment destination, String segment, EncodingCharacters encodingChars, Integer theRepetition) throws HL7Exception {
    if(!"OBX".equals(destination.getName()) || destination.getParent().getParent().getAll("OBSERVATION").length <= 5) {
        super.parse(destination, segment, encodingChars, theRepetition);
    }
}

Use this to parse your messages and it will only parse the first 5 OBSERVATIONS in the ORDER_DETAIL.

Buddha Buddy
  • 148
  • 8