Apache camel 从ActiveMQ到javabean

Apache camel 从ActiveMQ到javabean,apache-camel,jbossfuse,Apache Camel,Jbossfuse,我试图学习Fuse上的Camel-在本例中,使用Dozer组件在名为CustInfo的Java对象中转换ActiveMQ消息: <camelContext id="context-43faded0-825e-454b-8037-c72122aa0418" xmlns="http://camel.apache.org/schema/blueprint"> <propertyPlaceholder location="classpath:sql.properties" id="

我试图学习Fuse上的Camel-在本例中,使用Dozer组件在名为CustInfo的Java对象中转换ActiveMQ消息:

<camelContext id="context-43faded0-825e-454b-8037-c72122aa0418" xmlns="http://camel.apache.org/schema/blueprint">
  <propertyPlaceholder location="classpath:sql.properties" id="properties"/>
  <endpoint uri="dozer:toCustInfo?sourceModel=homeloancust.CustInfo&amp;targetModel=org.blogdemo.homeloan.model.CustInfo&amp;unmarshalId=homeloancust&amp;mappingFile=toCustInfo.xml" id="toCustInfo"/>
  <dataFormats>
    <jaxb contextPath="homeloancust" id="homeloancust"/>
  </dataFormats>
  <route id="CustomerEvaluation">
      <from uri="activemq:queue:customer"/>
      <to ref="CustInfo" id="to3"/>
       . . . .
  </route>
</camelContext>

. . . .
我的问题是,如果我不需要在Java对象中进行转换,我可以直接将消息转换为Java类(不需要Dozer)。 试用:

<bean id="CustInfo" class="homeloancust.CustInfo"/>
. . .
<to ref="CustInfo" id="to3"/>

. . .

没有成功!有什么帮助吗?

假设传入消息有一个约定(如果遵循良好的约定优先方法,则应该这样做),那么您可以使用JAXB简单地将有效负载解组到Java对象中。如果没有约定,您仍然可以使用JAXB注释对Java类进行注释,并对其进行解组:

<unmarshal>
  <jaxb prettyPrint="true" contextPath="org.apache.camel.example"/>
</unmarshal>


谢谢你的帮助!