You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Srini97 <sr...@googlemail.com> on 2010/05/28 16:26:36 UTC
Handling map in the concurrentConsumers
Hello all,
I am using the concurrencyconsumers option in the routing. But I have create
a Map which should be shared for thread in the consumer. can any body guide
the sysntax for this . below is the code..
I wanted to use the following deliveryEndpoints map and myRetryBean as one
per thread. but the current code is sharing these accross all.
final Map<String, DeliveryEndpoint> deliveryEndpoints = new
HashMap<String, DeliveryEndpoint>();
RetryBean myRetryBean=(RetryBean)appContext.getBean("myRetryBean");
myRetryBean.setDeliveryEndpoints(deliveryEndpoints);
final FeedNotificationProcessor processor = new
FeedNotificationProcessor(deliveryEndpoints,
_getFeedBaseUri,
_endpointTakenBaseUri,
_instanceName);
context.addRoutes(new RouteBuilder() {
public void configure() {
from("jms-cif:queue:" +
_notificationQueue+"?concurrentConsumers="+concurrentConsumersSize)
.threads(concurrentConsumersSize)
.process(processor)
.onException(Exception.class).retryUntil(bean("myRetryBean")).end()
.recipientList(header("recipientListHeader").tokenize(","))
.parallelProcessing().executorService(customThreadPoolExecutor)
.aggregationStrategy(new RecipientAggregationStrategy(deliveryEndpoints,
_endpointDeliveredBaseUri))
.to("direct:chunk.completed");
Can any body help me on this.
Regards
Sri
--
View this message in context: http://old.nabble.com/Handling-map-in-the-concurrentConsumers-tp28707607p28707607.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Handling map in the concurrentConsumers
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
If you use for example Spring and use its <bean> to IoC the beans you
can just set the scope to prototype. Which causes Spring to create a
new instance on request.
In pure Java you have to handle that yourself.
On Fri, May 28, 2010 at 4:26 PM, Srini97 <sr...@googlemail.com> wrote:
>
> Hello all,
>
> I am using the concurrencyconsumers option in the routing. But I have create
> a Map which should be shared for thread in the consumer. can any body guide
> the sysntax for this . below is the code..
>
>
> I wanted to use the following deliveryEndpoints map and myRetryBean as one
> per thread. but the current code is sharing these accross all.
>
>
> final Map<String, DeliveryEndpoint> deliveryEndpoints = new
> HashMap<String, DeliveryEndpoint>();
>
> RetryBean myRetryBean=(RetryBean)appContext.getBean("myRetryBean");
> myRetryBean.setDeliveryEndpoints(deliveryEndpoints);
>
> final FeedNotificationProcessor processor = new
> FeedNotificationProcessor(deliveryEndpoints,
> _getFeedBaseUri,
> _endpointTakenBaseUri,
> _instanceName);
>
>
>
>
> context.addRoutes(new RouteBuilder() {
> public void configure() {
>
> from("jms-cif:queue:" +
> _notificationQueue+"?concurrentConsumers="+concurrentConsumersSize)
> .threads(concurrentConsumersSize)
> .process(processor)
> .onException(Exception.class).retryUntil(bean("myRetryBean")).end()
> .recipientList(header("recipientListHeader").tokenize(","))
> .parallelProcessing().executorService(customThreadPoolExecutor)
> .aggregationStrategy(new RecipientAggregationStrategy(deliveryEndpoints,
> _endpointDeliveredBaseUri))
> .to("direct:chunk.completed");
>
>
>
> Can any body help me on this.
>
> Regards
> Sri
>
>
>
>
> --
> View this message in context: http://old.nabble.com/Handling-map-in-the-concurrentConsumers-tp28707607p28707607.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
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