camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcostello <>
Subject Re: Dynamic JMS selector question (camel-jms)
Date Mon, 27 Apr 2015 13:49:31 GMT

I spent some time hacking on this over the weekend and figured out that it was happening because
of the spring caching connection factory. If you set cacheConsumers=false, the consumers are
removed when the polling is complete.


From: "gdubya [via Camel]" <<>>
Date: Monday, April 27, 2015 at 5:09 AM
To: Jeff Costello <<>>
Subject: Re: Dynamic JMS selector question (camel-jms)

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:
DynamicEndpointRouteBuilder(fromUri, toEndpointUri, routeId,
countDownLatch, username));
             camelContext.stopRoute(routeId, 10000, TimeUnit.MILLISECONDS);

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:
> Sent from the Camel - Users mailing list archive at

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Dynamic JMS selector question (camel-jms), click here<>.

View this message in context:
Sent from the Camel - Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message