camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: camel-context only seems to work within the same file or do I use it wrong?
Date Mon, 02 Sep 2013 02:28:14 GMT
Hi,

How did you define the whitebox.xml?
You can using the import resource to include the camel context that you want to use just like
this.
<import resource="classpath:META-INF/camel-routes.xml"/>


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, September 2, 2013 at 5:31 AM, dantam74 wrote:

> If I have two routes in separate files that depend on each other I'll get the
> following error message:
>  
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> TestWhiteBox: Route[[From[context:blackbox:testBlackBox]] -> [Log[Called
> b... because of Failed to resolve endpoint: context://blackbox:testBlackBox
> due to: Failed to resolve endpoint: Cannot create the camel context
> component for context blackbox
>  
> File 1. blackbox.xml
>  
> <camelContext id="blackbox"
> xmlns="http://camel.apache.org/schema/blueprint">
>  
> <route id="TestBlackBox">
> <from uri="direct:testBlackBox"/>
> <log message="Called black box"/>
> </route>
>  
> </camelContext>
>  
> File 2: whitebox.xml
>  
> <camelContext id="whitebox" xmlns="http://camel.apache.org/schema/blueprint"
> depends-on="blackbox">
>  
> <route id="TestWhiteBox">
> <from uri="context:blackbox:testBlackBox"/>
> <log message="Called black box from white box"/>
> </route>
>  
> </camelContext>
>  
> However, if I put both of the contexts in the same file it works.... But,
> that to me is kind of useless because I'm separating it in different files
> because I want the routes to be "black boxes" to eachother for structural
> reasons.
>  
> The below file works:
>  
> File 3:
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint
> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
> xsi:schemaLocation="
> http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> http://cxf.apache.org/blueprint/core
> http://cxf.apache.org/schemas/blueprint/core.xsd">
>  
> <camelContext id="blackbox"
> xmlns="http://camel.apache.org/schema/blueprint">
>  
> <route id="TestBlackBox">
> <from uri="direct:testBlackBox"/>
> <log message="Called black box"/>
> </route>
>  
> </camelContext>
>  
> <camelContext id="whitebox"
> xmlns="http://camel.apache.org/schema/blueprint" depends-on="blackbox">
>  
> <route id="TestWhiteBox">
> <from uri="context:blackbox:testBlackBox"/>
> <log message="Called black box from white box"/>
> </route>
>  
> </camelContext>
> </blueprint>
>  
> Any ideas? I would consider this a bug in the camel-context component.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-context-only-seems-to-work-within-the-same-file-or-do-I-use-it-wrong-tp5738442.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Mime
View raw message