title: How to use AMQP instead of JMS with Apache Camel?
body: <p>greetings all
  I am using the JMS with the following configuration to send messages between client &amp; server, and i need to replace jms with AMQP, and I need some guide, so please advise:</p>
  
  <p><strong>client-applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  --&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
          http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
          http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring-1.4.0.xsd
          http://cxf.apache.org/transports/camel http://cxf.apache.org/transports/camel.xsd"&gt;
  
      &lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /&gt;
  
      &lt;!--  Directly defined ConnectionFactory  --&gt;
      &lt;bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
          &lt;property name="brokerURL" value="tcp://localhost:61616" /&gt;
      &lt;/bean&gt;
  
      &lt;!--  By defining a JmsComponent called jms you can use the JMS transport in routes
          You may define several of these components if you have different JMS servers for
          different services. They can be distinguished in the routes by their id 
      --&gt;
      &lt;bean id="jms" class="org.apache.camel.component.jms.JmsComponent"&gt;
          &lt;property name="connectionFactory" ref="jmsConnectionFactory" /&gt;
          &lt;property name="useMessageIDAsCorrelationID" value="true" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Add the camel transport to CXF. So you can define endpoint in the form camel://direct:&lt;EndpointName&gt;
           in cxf client and server endpoints. These endpoints are then available in camel 
           as direct:&lt;EndpointName&gt; --&gt;
      &lt;bean class="org.apache.camel.component.cxf.transport.CamelTransportFactory"&gt;
          &lt;property name="bus" ref="cxf" /&gt;
          &lt;property name="camelContext" ref="camelContext" /&gt;
          &lt;property name="transportIds"&gt;
              &lt;list&gt;
                  &lt;value&gt;http://cxf.apache.org/transports/camel&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Define a cxf endpoint based on client stub generated from a wsdl.
          It is important to provide serviceName and endpointName so the wsdl is not needed
          at runtime. As far as I know the serviceName and endpointName do not have to have a special
          convention but it is good practice to use the service namespace and Service Interface name in the names
       --&gt;
      &lt;client id="CustomerService" xmlns="http://cxf.apache.org/jaxws" xmlns:customer="http://customerservice.example.com/"
          serviceName="customer:CustomerServiceService" endpointName="customer:CustomerServiceEndpoint"
          address="camel://direct:CustomerService" serviceClass="com.example.customerservice.CustomerService"&gt;
          &lt;features&gt;
              &lt;!-- Enables logging of SOAP messages. --&gt;
              &lt;!-- &lt;logging xmlns="http://cxf.apache.org/core" /&gt; --&gt;
          &lt;/features&gt;
      &lt;/client&gt;
  
      &lt;!-- This context defines a route for each endpoint. For client endpoints you route from
          the cxf endpoint to the jms queue or topic. For servers you route from the jms queue or 
          topic to the cxf endpoint --&gt;
      &lt;camelContext id="camelContext" xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
          &lt;route&gt;
              &lt;from uri="direct:CustomerService" /&gt;
              &lt;to uri="jms://queue:CustomerService" /&gt;
          &lt;/route&gt;
      &lt;/camelContext&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>server-applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  --&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
          http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
          http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
          http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring-1.4.0.xsd
          http://cxf.apache.org/transports/camel http://cxf.apache.org/transports/camel.xsd"&gt;
  
      &lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /&gt;
      &lt;import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /&gt;
  
      &lt;!--  Directly defined ConnectionFactory  --&gt;
      &lt;bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
          &lt;property name="brokerURL" value="tcp://localhost:61616" /&gt;
      &lt;/bean&gt;
  
      &lt;!--  By defining a JmsComponent called jms you can use the JMS transport in routes
          You may define several of these components if you have different JMS servers for
          different services. They can be distinguished in the routes by their id 
      --&gt;
      &lt;bean id="jms" class="org.apache.camel.component.jms.JmsComponent"&gt;
          &lt;property name="connectionFactory" ref="jmsConnectionFactory" /&gt;
          &lt;property name="useMessageIDAsCorrelationID" value="true" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Add the camel transport to CXF. So you can define endpoint in the form camel://direct:&lt;EndpointName&gt;
           in cxf client and server endpoints. These endpoints are then available in camel 
           as direct:&lt;EndpointName&gt; --&gt;
      &lt;bean class="org.apache.camel.component.cxf.transport.CamelTransportFactory"&gt;
          &lt;property name="bus" ref="cxf" /&gt;
          &lt;property name="camelContext" ref="camelContext" /&gt;
          &lt;property name="transportIds"&gt;
              &lt;list&gt;
                  &lt;value&gt;http://cxf.apache.org/transports/camel&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Define a cxf endpoint based on client stub generated from a wsdl.
          It is important to provide serviceName and endpointName so the wsdl is not needed
          at runtime. As far as I know the serviceName and endpointName do not have to have a special
          convention but it is good practice to use the service namespace and Service Interface name in the names
       --&gt;
      &lt;endpoint 
          xmlns="http://cxf.apache.org/jaxws"
          xmlns:customer="http://customerservice.example.com/"
          id="CustomerService" 
          address="camel://direct:CustomerService" 
          serviceName="customer:CustomerServiceService"
          endpointName="customer:CustomerServiceEndpoint" 
          implementor="com.example.customerservice.impl.CustomerServiceImpl"&gt;
          &lt;features&gt;
              &lt;!-- Enables logging of SOAP messages. --&gt;
              &lt;logging xmlns="http://cxf.apache.org/core" /&gt;
          &lt;/features&gt;
      &lt;/endpoint&gt;
  
      &lt;!-- This context defines a route for each endpoint. For client endpoints you route from
          the cxf endpoint to the jms queue or topic. For servers you route from the jms queue or 
          topic to the cxf endpoint --&gt;
      &lt;camelContext id="camelContext" trace="true" xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
          &lt;route&gt;
              &lt;from uri="jms://queue:CustomerService" /&gt;
              &lt;to uri="direct:CustomerService" /&gt;
          &lt;/route&gt;
      &lt;/camelContext&gt;
  &lt;/beans&gt;
  </code></pre>