Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CAMEL-5933

...

You can use the following snippet in your applicationcontext if you want to configure anything special. If you only want to activate the camel transport you do not have to do anything in your application context. As soon as you include the camel-cxf-transport jar (or camel-cxf.jar if your camel version is less than 2.7.x) in your app cxf will scan the jar and load a CamelTransportFactory for you.

Code Block
xml
xml
<!-- 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>

...

The camel:destination element for Spring has a number of child elements that specify configuration information. They are described below.

...

Element

Description

camel-spring:camelContext

You can specify the camel context in the camel conduit

camel:camelContextRef

The camel context id which you want inject into the camel conduit

Configure the destination and conduit with Blueprint

From Camel 2.11.x, Camel Transport supports to be configured with Blueprint

If you are using blueprint, you should use the the namespace http://cxf.apache.org/transports/camel/blueprintImage Added and import the schema like the blow.

Code Block
titleAdding the Configuration Namespace for blueprint

<beans ...
       xmlns:camel="http://cxf.apache.org/transports/camel/blueprint"
       ...
       xsi:schemaLocation="...
                           http://cxf.apache.org/transports/camel/blueprint 
                           http://cxf.apache.org/schmemas/blueprint/camel.xsd
                          ...>

In blueprint camel:conduit camel:destination only has one camelContext attribute, they doesn't support to specify the camel context in the camel destination.

Code Block

  <camel:conduit id="*.camel-conduit" camelContext="camel1" />
  <camel:destination id="*.camel-destination" camelContext="camel1" />

Namespace

If you are using blueprint, you should use the the namespace http://cxf.apache.org/transports/camel/blueprintImage Added and import the schema like the blow.

Code Block
titleAdding the Configuration Namespace for blueprint

<beans ...
       xmlns:camel="http://cxf.apache.org/transports/camel/blueprint"
       ...
       xsi:schemaLocation="...
                           http://cxf.apache.org/transports/camel/blueprint 
                           http://cxf.apache.org/schmemas/blueprint/camel.xsd
                          ...>

the camel:conduit element

Example Using Camel as a load balancer for CXF

...