You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bond <ch...@gmail.com> on 2010/07/24 07:48:06 UTC
Multiple Context
I have a following requirement.
<route>
<from uri="jms:topic:topic1"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
<route>
<from uri="jms:topic:topic2"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
<route>
<from uri="jms:topic:topic3"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
.
.
.
.
.
<route>
<from uri="jms:topic:topicN"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
N= No. of configured topics. All the above route are independent of each
other and parsing and processing would be daone in different threads.
I know above thing can be achieved in Java DSL using a for loop. I would
like to know if the same can be achived using spring xml.
Thanks in advance.
--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-Context-tp1925788p1925788.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Multiple Context
Posted by Ashwin Karpe <as...@progress.com>.
Hi,
BTW for doing is completely in Spring you will need to instantiate a Spring
based Camel Context as shown below.
Cheers,
Ashwin...
===================================================
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="jms:topic:topic1"/>
<from uri="jms:topic:topic2"/>
<from uri="jms:topic:topic3"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
</camelContext>
</beans>
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
Progress Software Corporation
http://fusesource.com http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com.com
http://opensourceknowedge.blogspot.com
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-Context-tp1925788p2806144.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Multiple Context
Posted by Ashwin Karpe <as...@progress.com>.
Hi,
The answer is yes...
What is more, you need not create 50 routes as you have in your example. You
can also do it as
<route>
<from uri="jms:topic:topic1"/>
<from uri="jms:topic:topic2"/>
<from uri="jms:topic:topic3"/>
<to uri="bean:msgParser"/>
<to uri="bean:msgProcessor"/>
</route>
Since the destinations remain the same (i.e bean:msgParser followed by
bean:msgProcessor), you can club all the from topic destinations as shown
above. All of the above topic destinations will send the exchange to
bean:msgParser.
Cheers,
Ashwin...
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
Progress Software Corporation
http://fusesource.com http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com.com
http://opensourceknowedge.blogspot.com
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-Context-tp1925788p2806134.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.