Hi Matvey, The approach of throwing an exception and returning the message to the queue in order to process another message that can be processed quicker is not a good solution. It is prrocessing expense incurred for no real value.
I would rather create 2 queues or 1 virtual queue/topic in activemq and direct payloads of lower size to one queue and the larger payloads to another. Thene you can separate your consumers to process the messages more optimally based on your specific requirements. Note that the Camel route need not change and this would be a simple configuration setting in activemq.xml You may want to check this out. http://activemq.apache.org/virtual-destinations.html Cheers, Ashwin... Matvey wrote: > > I need to configure Camel DSL / routes in such a way that on of my old > classes gets objects from JMS queue and sends objects to another JMS > queue. > > > I can use Camel API to do that, but it seems like in such a case I almost > do not use Camel: > > CamelContext context = new DefaultCamelContext(); > context.addComponent("activemq", > ActiveMQComponent.activeMQComponent("tcp://localhost:61616")); > context.start(); > Endpoint endpoint = > context.getEndpoint("activemq:test.queue?concurrentConsumers=2"); > PollingConsumer consumer = endpoint.createPollingConsumer(); > > > It is still not clear for me how should I do that in a "Camel way", using > Spring, annotations and mapping. > > Also one more important question: we have 1000 messages in a queue, POJO > class gets a message, as it mapped for this queue (analog of onMessage() > method), I need some time to process this message (sure there are multiple > threads), and sometimes I can not process this message immediately, so I > have 2 options: 1. to wait (either with Thread.sleep() or waiting for an > event) or 2. put this message back to queue. The question is - may I just > wait (case 1) or it's necessary to throw an exception and return this > message back to queue? > ----- --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) ---- Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://www.nabble.com/Newbie%3A-Mapping-JMS-Camel---Spring-to-POJO%2C-ActiveMQ-Queues-tp21558031s22882p21561805.html Sent from the Camel - Users mailing list archive at Nabble.com.