camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Visibility between camel contexts
Date Tue, 27 Jul 2010 06:18:18 GMT
On Tue, Jul 27, 2010 at 5:58 AM, Thiago Souza <tcostasouza@gmail.com> wrote:
>
> Hi,
>
>      In a standalone spring application context the following is perfectly
> fine:
>
>
>        <c:camelContext id="endpoints">
>                <c:endpoint id="source" uri="file://source" />
>                <c:endpoint id="target" uri="file://target" />
>        </c:camelContext>
>
>        <c:camelContext id="routes">
>                <c:route>
>                        <c:from ref="source" />
>                        <c:to ref="target" />
>                </c:route>
>        </c:camelContext>
>
>
>       That is, the configured camelContexts can see each other. Is it
> possible to achieve this in Karaf?  (i.e. "endpoints" goes in a xml and
> "routes" goes in another one)
>
>        I've tried with no success, the xml containing "routes" can not see
> the endpoints defined in "endpoints" (in another xml)
>

It's bad practice to use endpoints define in another CamelContext. As
Adrian said the CamelContext should be isolated.
The reason why the <endpoint> appears to work is because of Spring.
It's spring factory bean which creates the endpoint and add's to it's
ApplicationContext.
And hence why you can lookup the endpoint from another CamelContext.
Because it lookup in the shared Spring ApplicationContext.

Maybe we should enforce Camel to only accept endpoints created by itself.


> Regards,
> Thiago Souza
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Visibility-between-camel-contexts-tp2255423p2255423.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

Mime
View raw message