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.

Reply via email to