Re: Deploying same camelContext.xml in and out of OSGi
Hi, After doing some tests on the trunk version of servicemix4, I found the osgi example work perfectly with the camel-spring target namespace. I checked the osgi bundles , and found that it just a simple change which was made by Guillaume. He just let the kernel to load camel-osgi bundle before camel-spring bundle, so camel-spring spring handle will detect the CamelContextFactoryBean of osgi version first when it is loaded. Boom, what a sample and effect way to resolved the issue :) I will add a FAQ entry on the wiki for this. Willem James Strachan wrote: > 2009/3/26 Willem Jiang : >> Adding a Bundle-Activator into the camel-spring module will introduce the >> dependency of OSGi jars into camel-spring. >> I'm wandering if we could do some thing on the camel-osgi module's >> Bundle-Activator to override the camel-spring's Spring handler? > > Yeah -could we just not have a bundle activator in camel-osgi that > does the camel-osgi stuff - then delegate (if we need to) to spring-dm > stuff? > >
Re: Deploying same camelContext.xml in and out of OSGi
Hi, We are at the crossroads ("à la croisée des chemins in french"). It will be very difficult to maintain Camel projects runnable in OSGI and non-OSGI environments. OSGI projects are really specific because they depends on bundles, packages must be exported, imported in the MANIFEST file, procedure deployment and testing ... Moreover, the developers/architects will more and more use spring OSGI facilities like , to expose bundle services (and use them in another bundle) or to pass parameter coming from properties file. So, I cannot figure out how it will be possible possible to run a camel project in/out of OSGI servers My feeling is that for the developers, they need a ServiceMix kernel bundle that we can integrate within Eclipse/NetBeans/... in order to launch our camel routes and debug them. Temporary, we can use the remote debugging provided by ServiceMix (http://cwiki.apache.org/SMX4KNL/51-troubleshooting-debugging-and-profiling.html) to debug our code deployed externally of Eclipse. In consequence, don't change anything in the existing code. Regards, Charles James.Strachan wrote: > > 2009/3/26 Willem Jiang : >> Adding a Bundle-Activator into the camel-spring module will introduce >> the >> dependency of OSGi jars into camel-spring. >> I'm wandering if we could do some thing on the camel-osgi module's >> Bundle-Activator to override the camel-spring's Spring handler? > > Yeah -could we just not have a bundle activator in camel-osgi that > does the camel-osgi stuff - then delegate (if we need to) to spring-dm > stuff? > > > -- > James > --- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ > > - Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Deploying-same-camelContext.xml-in-and-out-of-OSGi-tp22684580p22737964.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Deploying same camelContext.xml in and out of OSGi
2009/3/26 Willem Jiang : > Adding a Bundle-Activator into the camel-spring module will introduce the > dependency of OSGi jars into camel-spring. > I'm wandering if we could do some thing on the camel-osgi module's > Bundle-Activator to override the camel-spring's Spring handler? Yeah -could we just not have a bundle activator in camel-osgi that does the camel-osgi stuff - then delegate (if we need to) to spring-dm stuff? -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
Re: Deploying same camelContext.xml in and out of OSGi
Adding a Bundle-Activator into the camel-spring module will introduce the dependency of OSGi jars into camel-spring. I'm wandering if we could do some thing on the camel-osgi module's Bundle-Activator to override the camel-spring's Spring handler? Willem On Thu, Mar 26, 2009 at 5:14 PM, Gert Vanthienen wrote: > Willem, > > 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. > > Regards, > > Gert Vanthienen > > Open Source SOA: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > 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 a > 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, but > 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 > " > http://activemq.apache.org/camel/schema/spring"; schema? > > http://www.springframework.org/schema/beans"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:camel="http://activemq.apache.org/camel/schema/spring"; > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://activemq.apache.org/camel/schema/spring > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd > http://activemq.apache.org/camel/schema/osgi > http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> > > http://activemq.apache.org/camel/schema/osgi";> > > uri="quartz://groupName/timerName/0,15,30,45/*/*/*/*/$" /> > > > > > > > - aaron > > >>> > >> > >> > >> > > > > >
Re: Deploying same camelContext.xml in and out of OSGi
Sounds like a good idea - assuming that the bundle activator kicks in before Spring DM processes the XML? 2009/3/26 Gert Vanthienen : > Willem, > > 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. > > Regards, > > Gert Vanthienen > > Open Source SOA: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > 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 a > 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, > but > 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 " > http://activemq.apache.org/camel/schema/spring"; schema? > > http://www.springframework.org/schema/beans"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:camel="http://activemq.apache.org/camel/schema/spring"; > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://activemq.apache.org/camel/schema/spring > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd > http://activemq.apache.org/camel/schema/osgi > http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> > > http://activemq.apache.org/camel/schema/osgi";> > > /> > > > > > > > - aaron > >>> >>> >>> >> >> > -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
Re: Deploying same camelContext.xml in and out of OSGi
Willem, 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. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 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 a 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, but 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 " http://activemq.apache.org/camel/schema/spring"; schema? http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:camel="http://activemq.apache.org/camel/schema/spring"; xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd http://activemq.apache.org/camel/schema/osgi http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> http://activemq.apache.org/camel/schema/osgi";> >>> /> - aaron >>> >> >> >> > >
Re: Deploying same camelContext.xml in and out of OSGi
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 a >>> 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, but >>> 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 " >>> http://activemq.apache.org/camel/schema/spring"; schema? >>> >>> http://www.springframework.org/schema/beans"; >>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >>>xmlns:camel="http://activemq.apache.org/camel/schema/spring"; >>>xsi:schemaLocation=" >>>http://www.springframework.org/schema/beans >>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >>>http://activemq.apache.org/camel/schema/spring >>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd >>>http://activemq.apache.org/camel/schema/osgi >>> http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> >>> >>> http://activemq.apache.org/camel/schema/osgi";> >>> >>> >>> >>> >>> >>> >>> >>> >>> - aaron >>> >> > > >
Re: Deploying same camelContext.xml in and out of OSGi
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 a >> 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, but >> 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 " >> http://activemq.apache.org/camel/schema/spring"; schema? >> >> http://www.springframework.org/schema/beans"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xmlns:camel="http://activemq.apache.org/camel/schema/spring"; >> xsi:schemaLocation=" >> http://www.springframework.org/schema/beans >> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >> http://activemq.apache.org/camel/schema/spring >> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd >> http://activemq.apache.org/camel/schema/osgi >> http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> >> >> http://activemq.apache.org/camel/schema/osgi";> >> >> >> >> >> >> >> >> >> - aaron >> > > -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
Re: Deploying same camelContext.xml in and out of OSGi
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 a > 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, but > 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 " > http://activemq.apache.org/camel/schema/spring"; schema? > > http://www.springframework.org/schema/beans"; >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >xmlns:camel="http://activemq.apache.org/camel/schema/spring"; >xsi:schemaLocation=" >http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >http://activemq.apache.org/camel/schema/spring > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd >http://activemq.apache.org/camel/schema/osgi > http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> > > http://activemq.apache.org/camel/schema/osgi";> > > > > > > > > > - aaron >
Deploying same camelContext.xml in and out of OSGi
I have the following XML I'd like to deploy both in an OSGi container, and a 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, but 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 " http://activemq.apache.org/camel/schema/spring"; schema? http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:camel="http://activemq.apache.org/camel/schema/spring"; xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd http://activemq.apache.org/camel/schema/osgi http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> http://activemq.apache.org/camel/schema/osgi";> - aaron