consumer.receive() will only receive a single message per call...try
something like this

while (true)
{
        // receive the message from the queue, wait at most 3 sec
        Exchange exchange = consumer.receive(3000);
        if (exchange == null)
        {
                // no more messages in queue
                break;
        }

        String body = exchange.getIn().getBody(String.class);
        logger.debug("body->" + body);
}


guddu wrote:
> 
> Hi all,
> 
>  I am new to camel and trying out camel with active mq.
> 
> Have notice some of the messages posted to the  queue is not received by
> the  polling consumer and gets lost ( have set the persistence as true on
> producer ?deliveryPersistent=true ). How can i ensure all the messages are
> received? 
> 
> 
> Consumer sample Code
> 
> PollingConsumer consumer = endpoint.createPollingConsumer();
>               consumer.start();
> Exchange exchange = consumer.receive(10000);
> 
> System.out.println(exchange.getIn().getBody());
> 


-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/active-mq-message-lost-tp4449530p4449664.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to