3 Replies Latest reply on Nov 30, 2015 8:41 PM by igarashitm

    camel bean to activemq

    mlybarger

      i am looking to build a switchyard service that reads messages from activemq and sends the message to another queue.  i'll need to implement a dynamic content based router and as such would like to leverage camel to handle the routing of output. 

       

      to start off, I just want to take the message in and send it out...

       

      
      
      
      
      
      from("switchyard://CamelService").log(
      
      
      
      
      
      
      "Received message for 'CamelService' : ${body}")
      
      
      
      
      
      
      .to("activemq:queue:queue/test.out");
      
      
      
      

       

      help?

        • 1. Re: camel bean to activemq
          igarashitm

          I would recommend to use switchyard://ActiveMQQueue or something and bind camel-jms binding to the reference instead of routing it to camel-activemq endpoint directly, so that the boundary would have SY aware interface and thus be visualized.

          1 of 1 people found this helpful
          • 2. Re: camel bean to activemq
            mlybarger

            Thanks for the reply.  I needed to learn how to specify in camel a message to a queue.  I don't want to use SY because I don't think it allows for dynamic binding of the output queue.

             

            public class CamelServiceRoute extends RouteBuilder {

              {

              System.setProperty("x.p", "queue/test1.out");

              System.setProperty("y.p", "queue/test2.out");

              }

             

              public void configure() {

              from("switchyard://CamelService").log( "Received message for 'CamelService' : ${body}")

              .setHeader("propName", xpath("/path").resultType(String.class))

              .recipientList(simple("jms:queue:${properties:${header.propName}} connectionFactory=#activemq/ConnectionFactory"));

              }

            }

             

             

            switchyard/CamelServiceRoute.java at master · mlybarger/switchyard · GitHub

            • 3. Re: camel bean to activemq
              igarashitm

              Oops, I just realized I overlooked this...

              I don't want to use SY because I don't think it allows for dynamic binding of the output queue.

               

              I haven't tried yet, but it should be possible to override the destination with specifying "destination" header for Camel JMS via SY context property.

              Apache Camel: JMS