2008/10/31 selezovikj <[EMAIL PROTECTED]>:
>
> When I am consuming from a JMS topic and set the concurrentConsumers property
> to 5, then the same message is replicated five times. That is so, because at
> the time the topic sees 5 subscribers and sends the same message to all
> subscribers. This is a behaviour which I don't want, because I want to have
> competing consumers, i.e. have messages consumed concurrently by multiple
> threads instead of sending the same message to 5 threads.
>
> <route>
>                        <from 
> uri="jms:topic:LoggingTopic?concurrentConsumers=5"/>
>                        <to uri="bean:msgParser"/>
>                        <to uri="direct:foo"/>
> </route>
>
> To achieve what I want I guess I should have a JMS queue which will consume
> messages from the topic, and then set concurrentConsumers on the queue.
> However, in that case I would have multiple routes, and to configure
> multiple routes in Spring I need to use the "direct" keyword, which
> unfortunately does not allow concurrentConsumers.
>
> <route>
>                        <from uri="jms:topic:LoggingTopic"/>
>                        <to uri="jms:queue:LoggingQueue"/>
>
> </route>
>
> <route>
>                        <from 
> uri="jms:queue:LoggingQueue?concurrentConsumers=5"/>
>                        <to uri = uri="bean:msgParser"/>
>
> </route>
>
> This one will not work. Any advice on how to achieve what I want ?

I don't understand why that one wouldn't work? i.e. you only need
competing consumers on the consuming endpoint (the second <from>)

Another thing you could try is experimenting with the underlying
MessageListenerContainer underneath the JMS endpoint; e.g. using
ServerSessionPool based one might help you process a single topic
subscription in parallel (which is what MDBs do I think)

e.g. on the JmsEndpoint's configuration try setting the ConsumerType
property enum to be ServerSessionPool

something like

JmsEndpoint endpoint = camelContext.getEndpoint("jms:whatever",
JmsEndpoint.class);
endpoint.getConfiguration().setConsumerType(ConsumerType.ServerSessionPool);

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Reply via email to