Thanks Richard. This helps.

I am using

Exchange exchange = consumer

  .receive(
"catalogJms:queue:queueName?mapJmsMessage=false&acknowledgementModeName=CLIENT_ACKNOWLEDGE"
);

even though i am not sending acknowledgement for received message, each
time it is polling different message. Any idea why that's happening?


Thanks,

Tarun


On Thu, Dec 19, 2013 at 12:40 AM, Richard Kettelerij <
richardkettele...@gmail.com> wrote:

> Set the mapJmsMessage=false option on the jms component to get the actual
> javax.jms.TextMessage. See http://camel.apache.org/jms.html for details
> (paragraph "Disabling auto-mapping of JMS messages").
>
>
> On Wed, Dec 18, 2013 at 7:59 PM, Tarun Kumar <agrawal.taru...@gmail.com
> >wrote:
>
> > Hi,
> >
> > I am creating a polling consumer using:
> >
> > from("timer://foo?period=5000").bean(cool, "someBusinessLogic");
> >
> > public static class MyCoolBean {
> >
> >     private int count;
> >     private ConsumerTemplate consumer;
> >     private ProducerTemplate producer;
> >
> >     public void setConsumer(ConsumerTemplate consumer) {
> >         this.consumer = consumer;
> >     }
> >
> >     public void setProducer(ProducerTemplate producer) {
> >         this.producer = producer;
> >     }
> >
> >     public void someBusinessLogic() {
> >         // loop to empty queue
> >         while (true) {
> >             // receive the message from the queue, wait at most 3 sec
> >             String msg = consumer.receiveBody("activemq:queue.inbox",
> 3000,
> > String.class);
> >             if (msg == null) {
> >                 // no more messages in queue
> >                 break;
> >             }
> >
> >             // do something with body
> >             msg = "Hello " + msg;
> >
> >             // send it to the next queue
> >             producer.sendBodyAndHeader("activemq:queue.foo", msg,
> "number",
> > count++);
> >         }
> >     }
> > }
> >
> > Here, i would like to receive jms message as Message or TextMessage
> instead
> > of string. I have tried:
> >
> > Exchange exchange = consumer
> >
> >   .receive("catalogJms:queue:queueName");
> >
> > exchange also doesn't give me message as javax.jms.Message or
> TextMessage.
> >
> >
> > Is there any way i can do this?
> >
>

Reply via email to