camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gert Vanthienen <>
Subject Re: Deploying same camelContext.xml in and out of OSGi
Date Thu, 26 Mar 2009 09:14:34 GMT

Would adding a Bundle-Activator to our jars help?  The activator would
only be called upon in an OSGi environment so it could take of putting
in place everything that's necessary for OSGi without the need for
anyone to change the configuration in the XML files.


Gert Vanthienen
Open Source SOA:

2009/3/26 Willem Jiang <>:
> Hi,
> Yes, in servicemix-camel component, we can use the Spring namespace for
> OSGi and non-OSGi environment. That is because ServiceMix take charge of
> the Camel Spring handler itself, and the Spring handler of camel-spring
> will detect the CamelContextFactoryBean of OSGi (in the camel-osgi
> bundle) by using Class.forName() and replace the CamelContextFactoryBean
> of Spring with the OSGi one.
> But if we deploy a camel context spring configure file into ServiceMix
> directly, the Spring handler will be inited by Spring DM first, and the
> Class.forName() detection will not work for camel-spring bundle anymore,
> since the camel-osgi bundle is not be installed at that time.
> Maybe we need to find some other way to accomplish this kind of auto
> replacing work.
> BTW, I don't if we can achieve this by using Spring java config ?
> Willem
> James Strachan wrote:
>> BTW I remember having a chat with Guillaume a while back and I don't
>> think the OSGi namespace in the XML is required any more; I think he
>> figured out how to wire in the OSGi injection without having to change
>> the XML namespace. Though I've not tested it to be sure though - want
>> to give it a try?
>> Then in OSGi you add camel-osgi but when not using OSGi you can omit
>> this dependency?
>> 2009/3/25 Willem Jiang <>:
>>> Hi Aaron
>>> The CamelContextFactoryBean of OSGi version extends the
>>> CamelContextFactoryBean of Spring version. It only add the handle of
>>> bundle context injection. For non-OSGi container it will not inject the
>>>  bundle context into the OSGi CamelContextFactoryBean, so the OSGi
>>> CamelContextFactoryBean will act as Spring CamelContextFactoryBean.
>>> The only side effect is you need to add the camel-osgi dependented third
>>> party jars into the class path.
>>> Willem
>>> Aaron Crickenberger wrote:
>>>> I have the following XML I'd like to deploy both in an OSGi container, and
>>>> non-OSGi container.  To deploy in the OSGi container, I have to use the
>>>> "osgi" schema so that the "quartz" component is resolved to the camel-quartz
>>>> bundle.
>>>> To deploy in a non-OSGi container, I had to add spring-osgi-core-1.1.2.jar
>>>> and org.osg.core-1.2.0.jar to the classpath.  It appears to be working,
>>>> I wanted to double-check with the experts.  Can you think of any
>>>> side-effects I might see from deploying this way vs. deploying w/ the "
>>>>" schema?
>>>> <beans xmlns=""
>>>>        xmlns:xsi=""
>>>>        xmlns:camel=""
>>>>        xsi:schemaLocation="
>>>>   <camelContext xmlns="">
>>>>     <camel:route>
>>>>       <camel:from uri="quartz://groupName/timerName/0,15,30,45/*/*/*/*/$"
>>>>       <camel:to uri="log:ExampleRouter"/>
>>>>     </camel:route>
>>>>   </camelContext>
>>>> </beans>
>>>> - aaron

View raw message