简体   繁体   English

HL7 2.7和Camel mina2

[英]HL7 2.7 and Camel mina2

Our customer changed the HL7 message format from 2.3 to 2.7 and I having some issue with new message format. 我们的客户将HL7消息格式从2.3更改为2.7,而我对新消息格式有一些疑问。 Basically we was able to route message using mina2 protocols in this way: 基本上,我们可以通过以下方式使用mina2协议路由消息:

<route>
<from uri="mina2:tcp://10.124.199.40:2575?sync=true&amp;codec=#hl7codec&amp;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: 确实,将格式从2.3更改为2.7无效,我们得到以下DEBUG消息:

 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. 我们正在使用HAPI作为消息解析器,恐怕应该是问题所在,但在这种情况下,我期望的是Camel应该能够通过mina2路由消息,并且当我们从业务中读取HL7消息时类捕获异常。 But it doesn't, it seems that mina2 is not able to routes the message. 但是事实并非如此,似乎mina2无法路由消息。

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? 是否可以在mina2解析之前捕获MLLP消息,以确保我们的客户以正确的格式发送它?

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? 我试图生成一个非常简单的jUnit类,以将消息发送到String消息,但是我不知道如何实现MLLP消息,我的问题是:mina2可以做到这一点吗(将String消息包装为MLLP格式) )还是在发送HL7消息之前必须要做的事情?

thanks, Andrea 谢谢,安德里亚

The problem was related to the MLLP message created and sent through mina2 listener. 该问题与通过mina2侦听器创建并发送的MLLP消息有关。 In camel, I defined the route in this way: 在骆驼中,我以这种方式定义了路线:

<route>
    <from uri="mina2:tcp://localhost:2576?sync=true&amp;codec=#hl7codecDebug&amp;noReplyLogLevel=DEBUG" />
    <to uri="file://HL7Messages?fileName=${file:name.noext}&amp;fileExist=Append"/>
    <log message="MINA2 DEBUG Message received" loggingLevel="INFO" />
</route>

The problem, basically was on camel-hl7 codec: 问题基本上是在camel-hl7编解码器上:

<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
    <property name="charset" value="UTF-8" />
</bean> 

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. 当然,我实际上看不到消息的内容,因此,我只是在HL7MLLPCodec类上添加了一些调试输出行,以帮助我了解问题所在。

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. 现在将编解码器从官方apache切换到我的调试版本,我可以看到所有字节发送到mina2,然后再解码并重定向到下一个路由步骤。

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: 概括一下,(我很确定以后会再读一遍),这些是封装HL7消息所需的字节:

startByte 0x0b The start byte spanning the HL7 payload.
endByte1 0x1c The first end byte spanning the HL7 payload.
endByte2 0x0d The 2nd end byte spanning the HL7 payload.

To start the camel context, I use this: 要启动骆驼上下文,我使用以下命令:

Main main = new Main();
main.setApplicationContext(new FileSystemXmlApplicationContext("src/test/resources/META-INF/spring/LOCALHOST-camel-context.xml"));
main.setDuration(-1);

main.run();

main is an instance of class org.apache.camel.spring.Main mainorg.apache.camel.spring.Main类的实例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM