78.10. 将 Camel 集成到 CXF 传输层

将 Camel 场合成您的 CXF 总线,您需要使用 CamelTransportFactory。您可以在 Java 中和 Spring 中执行此操作。

78.10.1. 在 Spring 中设置 Camel 传输

如果要配置任何特殊内容,您可以使用应用程序上下文中的以下代码片段:如果您只想激活 camel 传输,则不必在应用程序上下文中做任何操作。旦在您的应用程序中包含 camel-cxf-transport jar (or camel-cxf.jar),如果您的 camel 版本小于 2.7.x,则 cxf 将扫描 jar 并加载 CamelTransportFactory。

<!-- you don't need to specify the CamelTransportFactory configuration as it is auto load by CXF bus -->
<bean class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
  <property name="bus" ref="cxf" />
  <property name="camelContext" ref="camelContext" />
  <!-- checkException new added in Camel 2.1 and Camel 1.6.2 -->
  <!-- If checkException is true , CamelDestination will check the outMessage's
     exception and set it into camel exchange. You can also override this value
     in CamelDestination's configuration. The default value is false.
     This option should be set true when you want to leverage the camel's error
     handler to deal with fault message -->
  <property name="checkException" value="true" />
  <property name="transportIds">
    <list>
      <value>http://cxf.apache.org/transports/camel</value>
    </list>
  </property>
</bean>