You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dougly <dm...@gmail.com> on 2008/12/15 23:04:00 UTC

Multiple Running Context

Hi riders,
Is Camel 1.5 supporting multiple running context? I am trying to setup two
contexts in the same web application and it's not functioning properly.
Here is the config:

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
id="camel_email_context">
    <routeBuilderRef ref="mailRoute" />
    <routeBuilderRef ref="emailMessageRoute" />
  </camelContext>

<bean id="mailRoute" class="..." />
<bean id='mailConfigure' class="..." />

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
id="memoCreationContext">
  	<routeBuilderRef ref="memoCreationRoute" />
  </camelContext>

<bean id="memoCreationRoute" class="..." />

I use jconsole to view the consumer/endpoints. The 2 contexts are created
OK. But their endpoints/consumers are all messed up:

http://www.nabble.com/file/p21022918/ScreenShot001.jpg 

As you can see in the screenshot: only one consumer is created. The
"memoCreationContext" is not.
Also the endpoints of that "memoCreationContext" doesn't contain anything
except the Spring event.

Thanks guys
-- 
View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple Running Context

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Dec 16, 2008 at 4:39 PM, dougly <dm...@gmail.com> wrote:
>
> Hi Claus,
>
> I just tested the routes in our apps.
> Even with two separate running contexts I am able to see messages flowing
> between them! Whether this is a actual camel issue or jconsole issue (or
> even possibly, the MBean part of Camel issue) I don't know.
Yeah I think it's a Camel issue when it registers the route, consumes,
producers etc. in JMX.

Do you mind creating a ticket in JIRA for this, that jmx
instrmentation doesn't work properly for multiple camel contexts.



>
> Thanks
>
> Doug
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> I guess you might have found an issue there, or at least in the jconsole.
>>
>> Does the endpoints/consumers etc. work, but it's only the jconsole not
>> showing the correct picture?
>> I guess we need some unit tests with multiple context in the same
>> spring xml file.
>>
>>
>>
>> On Mon, Dec 15, 2008 at 11:04 PM, dougly <dm...@gmail.com> wrote:
>>>
>>> Hi riders,
>>> Is Camel 1.5 supporting multiple running context? I am trying to setup
>>> two
>>> contexts in the same web application and it's not functioning properly.
>>> Here is the config:
>>>
>>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>>> id="camel_email_context">
>>>    <routeBuilderRef ref="mailRoute" />
>>>    <routeBuilderRef ref="emailMessageRoute" />
>>>  </camelContext>
>>>
>>> <bean id="mailRoute" class="..." />
>>> <bean id='mailConfigure' class="..." />
>>>
>>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>>> id="memoCreationContext">
>>>        <routeBuilderRef ref="memoCreationRoute" />
>>>  </camelContext>
>>>
>>> <bean id="memoCreationRoute" class="..." />
>>>
>>> I use jconsole to view the consumer/endpoints. The 2 contexts are created
>>> OK. But their endpoints/consumers are all messed up:
>>>
>>> http://www.nabble.com/file/p21022918/ScreenShot001.jpg
>>>
>>> As you can see in the screenshot: only one consumer is created. The
>>> "memoCreationContext" is not.
>>> Also the endpoints of that "memoCreationContext" doesn't contain anything
>>> except the Spring event.
>>>
>>> Thanks guys
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21035441.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Re: Multiple Running Context

Posted by dougly <dm...@gmail.com>.
Hi Claus,

I just tested the routes in our apps.
Even with two separate running contexts I am able to see messages flowing
between them! Whether this is a actual camel issue or jconsole issue (or
even possibly, the MBean part of Camel issue) I don't know.

Thanks

Doug


Claus Ibsen-2 wrote:
> 
> Hi
> 
> I guess you might have found an issue there, or at least in the jconsole.
> 
> Does the endpoints/consumers etc. work, but it's only the jconsole not
> showing the correct picture?
> I guess we need some unit tests with multiple context in the same
> spring xml file.
> 
> 
> 
> On Mon, Dec 15, 2008 at 11:04 PM, dougly <dm...@gmail.com> wrote:
>>
>> Hi riders,
>> Is Camel 1.5 supporting multiple running context? I am trying to setup
>> two
>> contexts in the same web application and it's not functioning properly.
>> Here is the config:
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>> id="camel_email_context">
>>    <routeBuilderRef ref="mailRoute" />
>>    <routeBuilderRef ref="emailMessageRoute" />
>>  </camelContext>
>>
>> <bean id="mailRoute" class="..." />
>> <bean id='mailConfigure' class="..." />
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>> id="memoCreationContext">
>>        <routeBuilderRef ref="memoCreationRoute" />
>>  </camelContext>
>>
>> <bean id="memoCreationRoute" class="..." />
>>
>> I use jconsole to view the consumer/endpoints. The 2 contexts are created
>> OK. But their endpoints/consumers are all messed up:
>>
>> http://www.nabble.com/file/p21022918/ScreenShot001.jpg
>>
>> As you can see in the screenshot: only one consumer is created. The
>> "memoCreationContext" is not.
>> Also the endpoints of that "memoCreationContext" doesn't contain anything
>> except the Spring event.
>>
>> Thanks guys
>> --
>> View this message in context:
>> http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> 
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21035441.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple Running Context

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I guess you might have found an issue there, or at least in the jconsole.

Does the endpoints/consumers etc. work, but it's only the jconsole not
showing the correct picture?
I guess we need some unit tests with multiple context in the same
spring xml file.



On Mon, Dec 15, 2008 at 11:04 PM, dougly <dm...@gmail.com> wrote:
>
> Hi riders,
> Is Camel 1.5 supporting multiple running context? I am trying to setup two
> contexts in the same web application and it's not functioning properly.
> Here is the config:
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
> id="camel_email_context">
>    <routeBuilderRef ref="mailRoute" />
>    <routeBuilderRef ref="emailMessageRoute" />
>  </camelContext>
>
> <bean id="mailRoute" class="..." />
> <bean id='mailConfigure' class="..." />
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
> id="memoCreationContext">
>        <routeBuilderRef ref="memoCreationRoute" />
>  </camelContext>
>
> <bean id="memoCreationRoute" class="..." />
>
> I use jconsole to view the consumer/endpoints. The 2 contexts are created
> OK. But their endpoints/consumers are all messed up:
>
> http://www.nabble.com/file/p21022918/ScreenShot001.jpg
>
> As you can see in the screenshot: only one consumer is created. The
> "memoCreationContext" is not.
> Also the endpoints of that "memoCreationContext" doesn't contain anything
> except the Spring event.
>
> Thanks guys
> --
> View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Re: Multiple Running Context

Posted by dougly <dm...@gmail.com>.
Hi James,

We have an library that wraps the camel mail to poll a mail box, transform
mail into pojos and call a interface with the pojos passed to.

Now in our web app, we are using the library. And we want to have a separate
camel context (or to be more precise, a separate route) from the one coming
with the library to publish the mail pojos to a jms queue.

Therefore, the app has two contexts (two distinct route builders) I would
say.
Does it make sense?

Thanks guys


James.Strachan wrote:
> 
> Just out of interest - why do you want 2 CamelContext instances? The
> idea in Camel is that there is only one per Spring XML
> 
> 2008/12/15 dougly <dm...@gmail.com>:
>>
>> Hi riders,
>> Is Camel 1.5 supporting multiple running context? I am trying to setup
>> two
>> contexts in the same web application and it's not functioning properly.
>> Here is the config:
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>> id="camel_email_context">
>>    <routeBuilderRef ref="mailRoute" />
>>    <routeBuilderRef ref="emailMessageRoute" />
>>  </camelContext>
>>
>> <bean id="mailRoute" class="..." />
>> <bean id='mailConfigure' class="..." />
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
>> id="memoCreationContext">
>>        <routeBuilderRef ref="memoCreationRoute" />
>>  </camelContext>
>>
>> <bean id="memoCreationRoute" class="..." />
>>
>> I use jconsole to view the consumer/endpoints. The 2 contexts are created
>> OK. But their endpoints/consumers are all messed up:
>>
>> http://www.nabble.com/file/p21022918/ScreenShot001.jpg
>>
>> As you can see in the screenshot: only one consumer is created. The
>> "memoCreationContext" is not.
>> Also the endpoints of that "memoCreationContext" doesn't contain anything
>> except the Spring event.
>>
>> Thanks guys
>> --
>> View this message in context:
>> http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21034935.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple Running Context

Posted by Ramon Buckland <ra...@gmail.com>.
On Tue, Dec 16, 2008 at 21:25, James Strachan <ja...@gmail.com>wrote:

> Just out of interest - why do you want 2 CamelContext instances? The
> idea in Camel is that there is only one per Spring XML


I am not sure on the original posters reasonings, but I have the following
scenario that has me thinking the same thing also ..

I have not thougroughly thought this through .. but (ie, i hope there is a
better way to achieve this)

   Logical seperation of routes (2 systems in one running AMQ)
        - separate config
        - separate management controls (stop/start)

In activemq.xml I can

    <import resource="path/to/camel-context.xml"/>

Now, as it turns out, we have multiple business units wanting the same AMQ
instance to "run" their flows.
Logical, yes, the team that manages Support, wants this too.

So .. what makes sense is for each of these units / flows to be isolated :
shutdown one (via jmx) and the other(s) are not affected.

Also, we want to have the configuration logically separated

<beans><!-- activemq.xml -->
    ...
    <import resource="path/to/camel-context/business-unit1.xml"/>
    <import resource="path/to/camel-context/business-unit2.xml"/>
    ...
</beans>

But .. I can't do this ..

   <camelContext ... >
        <import resource="path/to/camel-context-routes/business-unit1.xml"/>
        <import resource="path/to/camel-context-routes/business-unit2.xml"/>
   </camelContext>

because the "imported" file is itself a <beans> XML file. so each XML file
needs to have a separate context defined. *or* put another way, you can't
import a <beans> XML into / as a subset of, another <bean> defn, be it the
<camelContext>

Hope that makes it clear.
r.

Re: Multiple Running Context

Posted by James Strachan <ja...@gmail.com>.
Just out of interest - why do you want 2 CamelContext instances? The
idea in Camel is that there is only one per Spring XML

2008/12/15 dougly <dm...@gmail.com>:
>
> Hi riders,
> Is Camel 1.5 supporting multiple running context? I am trying to setup two
> contexts in the same web application and it's not functioning properly.
> Here is the config:
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
> id="camel_email_context">
>    <routeBuilderRef ref="mailRoute" />
>    <routeBuilderRef ref="emailMessageRoute" />
>  </camelContext>
>
> <bean id="mailRoute" class="..." />
> <bean id='mailConfigure' class="..." />
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"
> id="memoCreationContext">
>        <routeBuilderRef ref="memoCreationRoute" />
>  </camelContext>
>
> <bean id="memoCreationRoute" class="..." />
>
> I use jconsole to view the consumer/endpoints. The 2 contexts are created
> OK. But their endpoints/consumers are all messed up:
>
> http://www.nabble.com/file/p21022918/ScreenShot001.jpg
>
> As you can see in the screenshot: only one consumer is created. The
> "memoCreationContext" is not.
> Also the endpoints of that "memoCreationContext" doesn't contain anything
> except the Spring event.
>
> Thanks guys
> --
> View this message in context: http://www.nabble.com/Multiple-Running-Context-tp21022918s22882p21022918.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



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

Open Source Integration
http://fusesource.com/