You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Евгений Лиукконен <ev...@gmail.com> on 2010/07/08 14:57:41 UTC
Runtime configuration of concurrent consumers.
Hello.
Camel is able to process messages from one queue concurrently. For final
application it is a good feature: it decreases time to process batch of
messages.
At the stage of debug it is may be a little discomfort: order of output
messages may differ from order of input messages. To prevent it, the
route-builder URI of endpoint may be expanded with "?maxConcurrentConsumers"
option.
The problem appears when I want to reconfigure the existing route. I can
modify the endpoint
for (Endpoint endpoint : camelContext.getEndpoints()) {
((JmsEndpoint) endpoint).setMaxConcurrentConsumers(1);
}
but this will not affect the existing consumers.
We can look at listener container
((JmsConsumer)
(context.getRoutes().get(0).getConsumer()))
.getListenerContainer()
It have a default value of maxConcurrentConsumer=20, it is not changed.
Is it possible to reconfigure routes at runtime to change the value of
maxConcurrentConsumers?
Thank you for your attention.
Re: Runtime configuration of concurrent consumers.
Posted by Eugeny Liukkonen <ev...@gmail.com>.
Thank you, Claus!
It worked!
If somebody is interested in this code:
[code]
try{
for (Route route: camelContext.getRoutes()){
JmsEndpoint jmsEndpoint = (JmsEndpoint) route.getEndpoint();
jmsEndpoint.setMaxConcurrentConsumers(1);
route.getConsumer().stop();
route.getConsumer().start();
}
} catch (Exception e) {
e.printStackTrace();
}
[/code]
2010/7/8 Claus Ibsen <cl...@gmail.com>
> Hi
>
> You need to restart the consumer for those values to take affect.
>
>
> 2010/7/8 Евгений Лиукконен <ev...@gmail.com>:
> > Hello.
> >
> > ...
> > ...
> > ...
> >
> > Is it possible to reconfigure routes at runtime to change the value of
> > maxConcurrentConsumers?
> >
> >
> > Thank you for your attention.
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: Runtime configuration of concurrent consumers.
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You need to restart the consumer for those values to take affect.
2010/7/8 Евгений Лиукконен <ev...@gmail.com>:
> Hello.
>
> Camel is able to process messages from one queue concurrently. For final
> application it is a good feature: it decreases time to process batch of
> messages.
>
> At the stage of debug it is may be a little discomfort: order of output
> messages may differ from order of input messages. To prevent it, the
> route-builder URI of endpoint may be expanded with "?maxConcurrentConsumers"
> option.
>
> The problem appears when I want to reconfigure the existing route. I can
> modify the endpoint
>
> for (Endpoint endpoint : camelContext.getEndpoints()) {
> ((JmsEndpoint) endpoint).setMaxConcurrentConsumers(1);
> }
>
> but this will not affect the existing consumers.
>
> We can look at listener container
>
> ((JmsConsumer)
> (context.getRoutes().get(0).getConsumer()))
> .getListenerContainer()
>
> It have a default value of maxConcurrentConsumer=20, it is not changed.
>
> Is it possible to reconfigure routes at runtime to change the value of
> maxConcurrentConsumers?
>
>
> Thank you for your attention.
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus