We recently did something similar for a JMS selector. In our case we need to select a particular JMS message from a dead letter queue (based on the message ID).

In short, we add the route dynamically, give it 10 seconds to process, then remove the route from the context. We then also need to remove the endpoints because, as you said, they are generated for a particular JMS selector and it does not appear to be possible to modify this dynamically..

E.g. something like this:
camelContext.addRoutes(new DynamicEndpointRouteBuilder(fromUri, toEndpointUri, routeId, countDownLatch, username));
            camelContext.stopRoute(routeId, 10000, TimeUnit.MILLISECONDS);
            camelContext.removeRoute(routeId);
            camelContext.removeEndpoints(fromUri);

So... have you tried removing the endpoints like this?



On 24. april 2015 22:58, jcostello wrote:
I'm trying to build a very simple route that periodically moves messages from
one queue to another until the from queue is empty. The catch is that route
needs to check the message age each time and only move the messages that
were in the queue when it started. I typically do this by calculating the
time when the process starts and setting a JMS selector based on that.

I've tried this two ways. One using a polling consumer and the other using a
route policy to start / stop the route. In both cases, I notice that the
camel-jms component doesn't actually change the message selector of the
current consumers. Instead, it creates new consumers with the new message
selector *and leaves the old ones in place*.

I need a way to either kill the old consumers or simply change the selector
on the existing consumers. I've tried the various stop() methods, but those
did not work. What is the best way to do this?

Thanks for your help!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-JMS-selector-question-camel-jms-tp5766313.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to