1 Reply Latest reply on Oct 18, 2011 8:13 PM by ffang

    CXF + ActiveMQ Queues + Failover?

    jamie3_james.archibald

      I'd like to generate a CXF client that uses ActiveMQ for sending messages to a Web Service that uses a WSDL first approach for generating the POJO service. I'd like the client and service to exchange messages via ActiveMQ Queues but also support failover as I might have multiple services deployed across the network. Ideally I want the transport layer to be abstracted from the developer such that I don't have to manually write the camel routes to route the soap requests from CXF camel component to my service bean.

       

      Is this possible?

       

      Heres a sample code snippet of what I'm thinking.

       

       

       

      public class MyMessage implements Serializable {

         // ...

      }

       

       

      public interface MyService {

       

         public void sendMessage(MyMessage msg);

      }

       

      @WebService

      public MyServiceImpl implements MyService {

       

          public void sendMessage(MyMessage msg) {

             // process message

          }

      }

       

      // CXF generated client

      public MyClient implements MyService {

        // ...

      }

        • 1. Re: CXF + ActiveMQ Queues + Failover?
          ffang

          Hi,

           

          You can use jms transport for CXF, which by default will use activemq as underlying transport, we have several jms* demo shipped with CXF kit, you may need take a look.

           

          For the Failover, you multiple services can monitor different queues, and configure jaxws client a failover feature, take a look at to get more concrete ideas(it's used for http transport but you can adapt it to be applicable for jms transport)

           

          More over, if multiple serivces which listen on the same queue, as only one service can get message from the jms queue,so multiple services will use round robin way to determine which service should be invoked, thus could be used as load balancing

          http://fusesource.com/docs/framework/2.3/deploy_guide/CXFDeployHAStaticFailover.html

           

          Freeman