3 Replies Latest reply: Apr 30, 2012 10:01 AM by Daniel Bevenius RSS

    How can i use switchyard camel with activemq?

    alex liu Newbie

      I get confused in  switchyard camel ,Mq in default is hornetQ,But I am interesting in how to use activemq with camel

        • 1. Re: How can i use switchyard camel with activemq?
          Daniel Bevenius Master

          Hi,

           

          I've not had time to try this out yet, but in theory you should be able to use a CDI to specify a method that creates an ActiveMQComponent:

           

          import javax.enterprise.context.ApplicationScoped;
          import javax.enterprise.inject.Produces;
          import javax.inject.Named;
          import org.apache.activemq.ActiveMQConnectionFactory;
          import org.apache.activemq.camel.component.ActiveMQComponent;
           
          @ApplicationScoped
          public class ActiveMQComponentFactory {
              
              @Produces @Named ("activemq")
              public ActiveMQComponent createActiveMQComponent() {
                  final ActiveMQComponent ac = new ActiveMQComponent();
                  final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
                  factory.setBrokerURL("vm://localhost?broker.persistent=false&broker.useJmx=false");
                  ac.setConnectionFactory(factory);
                  return ac;
              }
           
          }
          

           

          In SwitchYard CDI components are available to Camel's registry so you can specify 'activemq' in the uri as shown below:

          <camel:binding.camel configURI="activemq://TestQueue"/>
          

           

           

          Regards,

           

          /Daniel

          • 2. Re: How can i use switchyard camel with activemq?
            Keith Babo Master

            In addition to what Dan posted, you will also need to add the activemq camel component and dependencies as modules in the AS7 distribution.

             

            I would be interested in hearing about how this turns out, so please post back with questions/results if you decide to try it yourself.  If not, we'll probably get around crafting an example sooner or later.

            • 3. Re: How can i use switchyard camel with activemq?
              Daniel Bevenius Master

              We've add a jira for this which you can find here:

              https://issues.jboss.org/browse/SWITCHYARD-747