Our customer changed the HL7 message format from 2.3 to 2.7 and I having some issue with new message format. Basically we was able to route message using mina2 protocols in this way:
<route>
<from uri="mina2:tcp://10.124.199.40:2575?sync=true&codec=#hl7codec&minaLogger=true" />
[...]
</route>
and it worked fine untile the upgrade of message standard. Indeed, changing the format from 2.3 to 2.7 it doesn't work, we get this DEBUG message:
2014-01-13 10:15:57,361 DEBUG HL7MLLPDecoder [104] - Start scanning buffer at position 0
2014-01-13 10:15:57,361 WARN HL7MLLPDecoder [122] - Ignoring unexpected 1st end byte 28. Expected 2nd endpoint
2014-01-13 10:15:57,361 DEBUG HL7MLLPDecoder [56] - No complete message in this packet
We are using HAPI as message parser and I'm afraid it should be the problem but, in this case, what I'm expecting is that Camel should be able to route the message though mina2 and, when we read HL7 message from our business classes catch an exception. But it doesn't, it seems that mina2 is not able to routes the message.
Any clue with that? Is it possible to capture the MLLP message before is parsed by mina2 just to be sure our customers are sending it in the right format?
I've also another question. I was trying to generate a very easy jUnit class to send a message to a String message but I don't know how to implement a MLLP message and, my question is: is it something that mina2 does (wrapping a String message to MLLP format) or something I've to do before send the HL7 message?
thanks, Andrea
The problem was related to the MLLP message created and sent through mina2 listener. In camel, I defined the route in this way:
The problem, basically was on camel-hl7 codec:
Of course I wasn't able to see actually the content of message so, I just added some debug output rows on HL7MLLPCodec classes to help me to understand what was the problem.
Now switching the codec from official apache to my debug version I'm able to see all bytes sent to mina2 before they're decoded and redirected to next route step.
Just to recap, (I'm quite sure I'll re-read this post again and again in the future), these are the bytes required to encapsulate an HL7 message:
To start the camel context, I use this:
main is an instance of class org.apache.camel.spring.Main