camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ankelee <andreasasm...@gmail.com>
Subject Re: Direct-route not shared across contexts?
Date Mon, 14 Jun 2010 15:33:06 GMT

Hi

I created a ticket on this as a bug.
I created a sample where my issue is isolated based on Claus's test. and the
test can't even run because of the 2 consumer on one direct-exception

https://issues.apache.org/activemq/browse/CAMEL-2811

I can solve this by just loading two camel Main-classed and have the
contexts completely seperated. But I think it shouldn't be necessary.




ankelee wrote:
> 
> Hi
> 
> I think the problem lies in the way I import a routeContext in both my
> .xml files. The import is not done in the camelContext tag and therefore
> the two contexts might be sharing the routedefinition? Obviously this
> setup is the same as doing to imports of the same xml in a row which
> shouldn't really do anything.
> Can I somehow either do two instances of the imported route, or have an
> instance in a CamelContext or something?
> 
> regres-camelcontext.xml:
> 	<import resource="generic-edi-routes.xml" />
> 
> 	<!-- CamelContext definition -->
> 	<camelContext id="opsigContext"
> xmlns="http://camel.apache.org/schema/spring">
> 		<!-- Load properties -->
> 		<propertyPlaceholder id="properties"
> location="classpath:opsig.properties" /> ...
> 
> 
> opsig-camelcontext.xml:
> 	<import resource="generic-edi-routes.xml" />
> 
> 	<!-- CamelContext definition -->
> 	<camelContext id="opsigContext"
> xmlns="http://camel.apache.org/schema/spring">
> 		<!-- Load properties -->
> 		<propertyPlaceholder id="properties"
> location="classpath:opsig.properties" /> ...
> 
> 
> Also I can see that only the first context+route is working when doing it
> that way.
> 
> If I load the two contexts in completely seperate containers it works as
> intended:
> 
> 	public static void main(String[] args) throws Exception {
> 		Main camelMain = new Main();
> 		camelMain.setApplicationContextUri("regres-camelcontext.xml");
> 		camelMain.enableHangupSupport();
> 		camelMain.start();
> 		
> 		Main camelMain2 = new Main();
> 		camelMain2.setApplicationContextUri("opsig-camelcontext.xml");
> 		camelMain2.enableHangupSupport();
> 		camelMain2.start();
> 	}
> 
> 
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> Hi
>> 
>> I have created unit tests in both pure Java and with Spring XML and
>> cannot reproduce any such behavior
>> http://svn.apache.org/viewvc?rev=951088&view=rev
>> 
>> Direct endpoints with same endpoint uri is not shared between multiple
>> CamelContext.
>> 
>> So double check on your end what you may do wrong or what you do
>> differently.
>> 
>> On Thu, Jun 3, 2010 at 4:20 PM, ankelee <andreasasmuss@gmail.com> wrote:
>>>
>>> Hi
>>>
>>>
>>> Running on Windows in JVM 1.6.
>>>
>>> I'm just loading it into a Spring container in Java main:
>>>
>>> private static String fileRessource = "isuite-client-context.xml";
>>>
>>> ClassPathXmlApplicationContext x = new
>>> ClassPathXmlApplicationContext(fileRessource);
>>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> Whats your runtime environment?
>>>> And how do you start your app?
>>>> Do you use OSGi or WAR etc?
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Jun 3, 2010 at 2:28 PM, ankelee <andreasasmuss@gmail.com>
>>>> wrote:
>>>>>
>>>>> Perhaps I'm doing it wrong.
>>>>>
>>>>> I load a Spring context xml file that has two imports as such.
>>>>>
>>>>> <import resource="common-beans.xml"/>
>>>>> <import resource="first-camelcontext.xml"/>
>>>>> <import resource="second-camelcontext.xml"/>
>>>>>
>>>>> The two camelcontext.xml files obviously holds a <camelContext>
tag
>>>>> each.
>>>>>
>>>>> Each of contexts loads a identical route that they create their own
>>>>> instance
>>>>> of. These are configured differently with properties. Then I get a
>>>>> "direct
>>>>> endpoint cannot have more than 1 active consumer" when I run them at
>>>>> the
>>>>> same time. Maybe I don't really have two camelcontexts or?
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Direct-route-not-shared-across-contexts--tp28766143p28766770.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
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Direct-route-not-shared-across-contexts--tp28766143p28768147.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
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Direct-route-not-shared-across-contexts--tp28766143p28881074.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message