You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by utopiaan <m....@gmail.com> on 2013/09/24 07:42:36 UTC

Reuse Route (in xml) in multiple bundles

Hi,

I am trying to implement the reuse of a single "template" route, defined in
XML, among multiple bundles. I have read that you can use the <import
resource="template-routes.xml"/> in combination with <routeContextRef
ref="templateRoutesContext"/>

This does work, BUT only if it is in a SINGLE bundle. 

What I would like to have is: my template-routes.xml in my baseBundle and
all my other bundles import the template-routes.xml from that bundle and use
it (together with some <endpoint /> I have defined, to instantiate a route
for that specific bundle.

My problem lies in the fact that either the import of the definition
(template-routes.xml) does not work and when it seems to be working (i.e. no
exception) the bundle generates an exception on the  templateRoutesContext
stating that it can not find it.

I would like to know if this is possible, a good idea, and how do I
configure my pom.xml in such a way that it will work (since I think here
lies my problem). But a good online example resource would be great also.

I am using Apache servicemix/karaf/camel, Spring and Maven as core
technologies.

Kind regards,







--
View this message in context: http://camel.465427.n5.nabble.com/Reuse-Route-in-xml-in-multiple-bundles-tp5740091.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Reuse Route (in xml) in multiple bundles

Posted by Henrique Viecili <vi...@gmail.com>.
One possible option for you is to specify the OSGi Fragment-Host header
when packaging your bundles. That way the classpath is shared between
bundles, and your template-routes.xml file should be visible. (
http://wiki.osgi.org/wiki/Fragment and
http://docs.spring.io/osgi/docs/1.1.0/reference/html/appendix-tips.html)


Maybe you could try to expose/export your routeConfiguration as a
'blueprint service' and reuse it the other bundles, not sure how to make it
work with xml based routes thou.


Henrique Viecili


2013/9/24 utopiaan <m....@gmail.com>

> Hi,
>
> I am trying to implement the reuse of a single "template" route, defined in
> XML, among multiple bundles. I have read that you can use the <import
> resource="template-routes.xml"/> in combination with <routeContextRef
> ref="templateRoutesContext"/>
>
> This does work, BUT only if it is in a SINGLE bundle.
>
> What I would like to have is: my template-routes.xml in my baseBundle and
> all my other bundles import the template-routes.xml from that bundle and
> use
> it (together with some <endpoint /> I have defined, to instantiate a route
> for that specific bundle.
>
> My problem lies in the fact that either the import of the definition
> (template-routes.xml) does not work and when it seems to be working (i.e.
> no
> exception) the bundle generates an exception on the  templateRoutesContext
> stating that it can not find it.
>
> I would like to know if this is possible, a good idea, and how do I
> configure my pom.xml in such a way that it will work (since I think here
> lies my problem). But a good online example resource would be great also.
>
> I am using Apache servicemix/karaf/camel, Spring and Maven as core
> technologies.
>
> Kind regards,
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Reuse-Route-in-xml-in-multiple-bundles-tp5740091.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>