4 Replies Latest reply on Oct 31, 2011 5:03 PM by Michał Warecki

    Camel ReplyTo ActiveMQ

    Michał Warecki Novice



      I have a question about ReplyTo header with ActiveMQ. When camel receive message from some queue with header ReplyTo pointing to some temporary queue, camel do not send message to this queue at the end of route. Have I got to send this reply message manually?


      Example route:


           <camel:from uri="activemq:queue:InvokeService?jmsMessageType=Map" pattern="InOut"/>

           <camel:to uri="log:input" />

           <camel:bean ref="inquiryUDDIClient" method="getServiceDetail" />


                <camel:method ref="serviceInvokerDynamicRouter" method="slip" />


           <camel:log message="$" loggingLevel="DEBUG"/>




        • 1. Re: Camel ReplyTo ActiveMQ
          Claus Ibsen Master

          Camel should send back the reply message if a JMSReplyTo header is given, and that there is a message body to send back.

          • 2. Re: Camel ReplyTo ActiveMQ
            Michał Warecki Novice

            So there is something wrong with this.

            I'm manipulating only "in" message and there is some body (java object) and headers:

            {JMSReplyTo=temp-queue://ID:MichalPC-54890-1320002952266-0:1:10, JMSCorrelationID=null, JMSExpiration=0, JMSTimestamp=1320003959180, JMSType=null, JMSRedelivered=false, JMSMessageID=ID:MichalPC-54890-1320002952266-0:1:3:1:10, JMSPriority=4, JMSDeliveryMode=2, JMSDestination=queue://InvokeService, JMSXGroupID=null, CamelBeanMethodName=invokeService}


            Maybe JMSCorrelationID is wrong?


            Client code:

            public Serializable sendAndReceive(final Serializable message, final String queueName, final Map<String, String> properties) {
                     Serializable reply = (Serializable) jmsTemplate.execute(new ProducerCallback<Object>() {
                           public Object doInJms(Session session, MessageProducer producer) throws JMSException {
                                TemporaryQueue queue = session.createTemporaryQueue();
                                ObjectMessage objectMessage = session.createObjectMessage();
                                Set<String> keySet = properties.keySet();
                                for(String key : keySet) {
                                     objectMessage.setStringProperty(key, properties.get(key));
                                producer.send(session.createQueue(queueName), objectMessage);
                                return session.createConsumer(queue).receive(30000);
                     return reply;


            After 30 second there is timeout with null reply value.

            Any suggestions what I'm doing wrong? Thx

            • 3. Re: Camel ReplyTo ActiveMQ
              Claus Ibsen Master

              You have configured the message type as a Map, but you send an Object from the client. I would assume they need to match.

              • 4. Re: Camel ReplyTo ActiveMQ
                Michał Warecki Novice

                Yes, you are right. I am really grateful for your help