camel-context only seems to work within the same file or do I use it wrong?
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 http://camel.apache.org/schema/blueprint";> File 2: whitebox.xml http://camel.apache.org/schema/blueprint"; depends-on="blackbox"> 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: 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";> http://camel.apache.org/schema/blueprint";> http://camel.apache.org/schema/blueprint"; depends-on="blackbox"> 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.
Re: camel-context only seems to work within the same file or do I use it wrong?
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. -- 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 > > xmlns="http://camel.apache.org/schema/blueprint";> > > > > > > > > > File 2: whitebox.xml > > http://camel.apache.org/schema/blueprint"; > depends-on="blackbox"> > > > > > > > > > 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: > > > 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";> > > xmlns="http://camel.apache.org/schema/blueprint";> > > > > > > > > > xmlns="http://camel.apache.org/schema/blueprint"; depends-on="blackbox"> > > > > > > > > > > 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).
Re: camel-context only seems to work within the same file or do I use it wrong?
Importing the resource sounds like a good idea :-) I tried it but unfortunately I get the following error: Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'import'. One of '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":description, "http://www.osgi.org/xmlns/blueprint/v1.0.0":type-converters, "http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}' is expected. I googled a bit and I've seen other examples now. Right now the whitebox.xml looks as below: 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";> http://camel.apache.org/schema/blueprint"; depends-on="blackbox"> -- 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-tp5738442p5738477.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-context only seems to work within the same file or do I use it wrong?
Oh, you are using Blueprint. Current Blueprint doesn't support to import the resource like the Spring does. You may need to consider export the camel-conetxt as a service and import this service in another blueprint. -- 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 2:15 PM, dantam74 wrote: > Importing the resource sounds like a good idea :-) I tried it but > unfortunately I get the following error: > > Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid > content was found starting with element 'import'. One of > '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":description, > "http://www.osgi.org/xmlns/blueprint/v1.0.0":type-converters, > "http://www.osgi.org/xmlns/blueprint/v1.0.0":service, > "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, > "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, > "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, > WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}' is expected. > > I googled a bit and I've seen other examples now. Right now the whitebox.xml > looks as below: > > > 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";> > > > > xmlns="http://camel.apache.org/schema/blueprint"; depends-on="blackbox"> > > > > > > > > > > > > > -- > 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-tp5738442p5738477.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: camel-context only seems to work within the same file or do I use it wrong?
Aha :-) I tested in Spring and it works. I think the service approach actually is what I'm looking for, since the import seems to "run" the xml-file again, which means if I include it in many files, camel will try to define the routes in the included files as many times as it's included. Where should I look to find information about export and import camel-context as a service? I very much appreciate your help. I've spend almost a day on trying to figure this out :-) http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd";> http://camel.apache.org/schema/spring"; depends-on="blackbox"> -- 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-tp5738442p5738480.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-context only seems to work within the same file or do I use it wrong?
Hi, I think you can refer the below mentioned link for creating a service in one blueprint and use the same service in other blueprint. http://www.ibm.com/developerworks/xml/library/os-osgiblueprint/index.html You have to use Service reference managers and Service managers for creating/accessing the services. -- 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-tp5738442p5738483.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-context only seems to work within the same file or do I use it wrong?
Just to add my solution to my question. I wanted to use camel-context to be able to enable me to split the camel definition files into different modules. I finally found the vm: component and it does exactly what I wanted to do, ie direct communication between contexts without having for activemq or similiar between. -- 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-tp5738442p5742205.html Sent from the Camel - Users mailing list archive at Nabble.com.