2 Replies Latest reply on Jan 12, 2012 7:30 AM by labo32_delaboe

    Camel and HornetQ  ?

    labo32_delaboe

      Hello,

       

      I want to deploy some camel routes in a JBoss AS 7

      and therefore I want to ask how to use the HornetQ

      JMS implementation provided by JBoss with camel.

       

      Thanks

      labo

        • 1. Re: Camel and HornetQ  ?
          davsclaus

          Hi

           

          If JBoss provides a HornetMQ component, then they may have some documentation how to do that.

           

          However HornetMQ should be a generic JMS compliant broker, so you should just be able to use the camel-jms component, and configure it's JMS ConnectionFactory.

           

          If you use a Spring XML file to configure your application, then you can configure this in the XML file.

           

          See the section Configuring different JMS providers at

          http://camel.apache.org/jms

          • 2. Re: Camel and HornetQ  ?
            labo32_delaboe

            That's it.

             

            1) Start JBoss with

            standalone.bat --server-config=standalone-preview.xml

            to enable hornetQ messaging

             

            2) Route

             

            camel config

             <camelContext trace="false" xmlns="http://camel.apache.org/schema/spring">
                     <routeBuilder ref="jmsRoute"></routeBuilder>
              </camelContext>
                
             
              <bean id="jmsRoute" class="test.JMSRoute"></bean>
              
              <bean id="hornetq" class="org.apache.camel.component.jms.JmsComponent">
                   <property name="connectionFactory" ref="myConnectionFactory"></property>
                 </bean>
            
            <jee:jndi-lookup id="myConnectionFactory" jndi-name="java:/ConnectionFactory"></jee:jndi-lookup>
            

             

            route

            package test;
            
            import org.apache.camel.builder.RouteBuilder;
            import org.apache.camel.spring.Main;
            
            public class JMSRoute extends RouteBuilder {
            
                 public static void main(String[] args) throws Exception {
                      new Main().run(args);
                 }
            
                 public void configure() {
                      from("quartz://timerName?cron=0/20 * * * * ?")
                      .setBody(constant("test"))
                                .to("log:IN?showHeaders=true")
                                .to("hornetq:queue:testQueue")
                                .to("log:IN?showHeaders=true");
                 }
            }
            
            

             

            Thanks

            labo