我一直在寻找在Tomcat中使用Camel来从指定端口路由HL7数据以由持久层处理的问题。我真的很难理解如何做到这一点。我使用Tomcat without Spring code作为基本配置示例。骆驼HL7的细节是here。我真的不知道如何更改uri(或创建适当的web.xml和camel-config-xml文件),以便监听MLLP连接,然后路由到合适的处理类。从文档的URI是:如何使用HL7侦听器配置Apache Camel并部署inTomcat
mina:tcp://localhost:8888?sync=true&codec=#hl7codec
到目前为止,我有一个弹簧servlet.xml中像这样(有错误CVC-复杂type.2.4.c:匹配通配符是严格的,但没有申报':camelContext骆驼):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:camel="http://activemq.apache.org/camel/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
<property name="charset" value="iso-8859-1"/>
</bean>
<bean id="hl7MessageHandler" class="util.HL7MessageHandlerService"/>
<camelContext id="hl7listener" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="mina:tcp://localhost:8888?sync=true&codec=#hl7codec"/>
<to uri="bean:hl7MessageHandler?method=lookupPatient"/>
</route>
</camelContext>
</beans>
和像这样的web.xml文件:可以为元素找到
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>HL7 Consumer</display-name>
<!-- location of spring xml files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/camel/*</url-pattern>
</servlet-mapping>
</web-app>
我真的不明白如何配置骆驼的路线,然后以保证传入的消息是通过d到HL7MessageHandler。
谢谢你克劳斯 - 我一直在努力通过这个。我已经开始研究基本配置,但是学习曲线相当陡峭。我编辑了原始问题,但仍需要一些指导。我想我需要从试图弄清楚我的基本结构是否正确开始。 – skyman
你需要一个骆驼路线,例如< route >< from >< to >< /route >它使用hl7端点,然后路由消息的某处你可以处理数据并准备响应等。我建议更多地研究骆驼。看到这篇文章:http://java.dzone.com/articles/open-source-integration-apache –
谢谢 - 我已经设法得到代码加载没有错误。 – skyman