camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "james.z.zhou" <james.z.z...@hotmail.com>
Subject RE: Why I cannot run multiple CamelContext simultaneously?
Date Sat, 23 Feb 2013 15:04:23 GMT
Hi DOLECEK:

Thank you very much for your reply! 

I tired with your suggestion, I EXPLICITLY set unique ids for the
camelContext, it is till NOT working. what I did is like this:

<camelContext xmlns="http://camel.apache.org/schema/spring" id="camelONE" >
<camelContext xmlns="http://camel.apache.org/schema/spring" id="camelTWO" >

I start jconsle and I found only the first *Hit*-"camelONE" shown up under
context.

I tired another thing, the routeContext. I took
http://camel.apache.org/how-do-i-import-routes-from-other-xml-files.html as
the reference and the result made me even more confused.

I have three routes, I put two in a routeContext and one in another
routeContext. I set explicitly the unique IDs to both the routeContexts and
routes:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
    ">

<routeContext id="oneCtx" xmlns="http://camel.apache.org/schema/spring">
        <route id="jpaRoute">
            <from
uri="jpa:com.xxx.xxx.xxx.xxx?consumer.nameQuery=xxx&amp;consumer.delay=500"/>
            <process=&quot;myProcessor&quot;>
            <filter>
            ...
            <to uri="jpa:com.xxx.xxx.xxx.xxx"/>
            </filter>            
        </route>

        <route id="tibcoRoute"> -- I am using TibRV version 8.3
            <from uri="tibco:listen?service=xxxx&amp;network=;xxx.xxx.xx.xxx
..."/>
            <process=&quot;myProcessor&quot;>
            <filter>
            ...
            <to uri="jpa:com.xxx.xxx.xxx.xxx"/>
            </filter>            
        </route>
</routeContext>
</beans>

another routeContext:

<routeContext id="twoCtx" xmlns="http://camel.apache.org/schema/spring">
        <route id="anoterTibcoRoute">
            <from uri="tibco:listen?service=xxxx&amp;network=;xxx.xxx.xx.xxx
..."/>
            <process=&quot;myProcessor&quot;>
            <filter>
            ...
            <to uri="tibco:listen?service=xxxx&amp;network=;xxx.xxx.xx.xxx
..."/>
            </filter>            
        </route>
</routeContext>
</beans>

The two routeContexts defined in two xml files, say routeContext1.xml and
routeContext2.xml. Then I added them into a camelContext:

<import resource="routeContext1.xml"/>
<import resource="routeContext2.xml"/>

<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeContextRef ref="oneCtx"/>
<routeContextRef ref="twoCtx"/>
...

After I start the appication, I can see all the three routes listed under
"Route", however, only the last *hit* route in the last *hit* routeContext, 
<route id="anoterTibcoRoute"> in this case, start doing job. If I change the
order of the two routeContexts in the camelContext, put <routeContextRef
ref="twoCtx"/> above <routeContextRef ref="oneCtx"/>, only <route
id="tibcoRoute"> start doing job.

Then I removed <routeContextRef ref="twoCtx"/> from the camelContext & just
kept <routeContextRef ref="oneCtx"/> in, I saw two routes in the jconsole
but only <route id="tibcoRoute"> start doing job, also the last *hit* one in
the routeContext.

Then, I tried with one last senario, still kept one routeContext:
<routeContextRef ref="oneCtx"/> in the camelContext, and added one route:
<route id="test">
<from uri="file://inputdir" />
<to uri="file://outputdir" />
</route>

The first time I removed  <route id="tibcoRoute">, kept <route id="test">
and <route id="jpaRoute">, both of them are working perfectly, the second
time I removed <route id="jpaRoute">, kept <route id="test"> and <route
id="tibcoRoute">, also working perfectly for both. So this proves
routeContext does support multiple routes run simultaneously. Another thing
I want to mention out is if I put <route id="jpaRoute"> and <route
id="tibcoRoute"> directly in a camelContext, both of them are working well,
simultaneously. 

Conclusion, does camel support both TibcoRV & jpa endpoints in ONE
routeContext? Anyother ideas about for my case, why multiple camelContext
cannot run simultaneously? namespace issue? conflict somewhere?

thanks

james




--
View this message in context: http://camel.465427.n5.nabble.com/Why-I-cannot-run-multiple-CamelContext-simultaneously-tp5727877p5728055.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message