You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "sanketh.reddy" <sa...@gmail.com> on 2012/03/12 07:08:23 UTC

Questions regarding usage of camel along with OSGI Declarative services ?

Hi,

   i have a single monolithic project which has its components segregated by
packages . i used a lot of spring xml's to define :


1. camel route's between these packages to send serialized java objects 
2. create singleton instances with injected properties which took care of
application lifecycle,
3. trigger some cron jobs on beans...etc . 


I deployed this project as a single osgi bundle in servicemix with no config
admin,service dependency management..etc because it was a single bundle 
.Now, we have a new requirement where some of our packages need to be
updated dynamically without bringing down the system .We have decided to
embrace the osgi standard and divide our project into independent component
bundles communicating via services . 
                              I have chosen osgi declarative services(felix
SCR) as my service dependency manager as it very light compared to
spring-DM(blueprint)  and provides most of the features i need . Moving to
OSGI DS means writing your service implementation classes as components .
Now , i want to keep my camel routes in spring xml and use some of the
components as beans in my camel routes (static instances) . Will this cause
any abnormal behaviour , how does camel context work along with the
bundlecontext provided by OSGI . Are there any best practices to keep in
mind when using camel with OSGI DS ?


Thanks
sanre6



-----
thanks
sanketh
mail : sanre6@gmail.com
--
View this message in context: http://camel.465427.n5.nabble.com/Questions-regarding-usage-of-camel-along-with-OSGI-Declarative-services-tp5556728p5556728.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Questions regarding usage of camel along with OSGI Declarative services ?

Posted by "sanketh.reddy" <sa...@gmail.com>.
i have been using apache servicemix for its ESB for a long time . But , never
used its osgi features till now 

-----
thanks
sanketh
mail : sanre6@gmail.com
--
View this message in context: http://camel.465427.n5.nabble.com/Questions-regarding-usage-of-camel-along-with-OSGI-Declarative-services-tp5556728p5560608.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Questions regarding usage of camel along with OSGI Declarative services ?

Posted by Christian Schneider <ch...@die-schneider.net>.
Btw. which OSGi server do you use. If you do not use it already I can 
really recommend using Apache Karaf. Installing camel on it is just as 
easy as executing two commands.

I have a tutorial for camel with Apache Karaf if you want to try it:
http://www.liquid-reality.de/x/G4Bk

Christian

Am 13.03.2012 09:48, schrieb sanketh.reddy:
> Thanks for clearing that out anyway i will be using blueprint for my service
> dependency management . It has all the spring goodies so porting my project
> will be easy . Main reason for choosing blueprint was avoiding different
> xml's for components and camel routes ,beans ..etc . while in blueprint i
> can use all of them in one xml .
>
> -----
> thanks
> sanketh
> mail : sanre6@gmail.com
> --
> View this message in context: http://camel.465427.n5.nabble.com/Questions-regarding-usage-of-camel-along-with-OSGI-Declarative-services-tp5556728p5560339.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Questions regarding usage of camel along with OSGI Declarative services ?

Posted by "sanketh.reddy" <sa...@gmail.com>.
Thanks for clearing that out anyway i will be using blueprint for my service
dependency management . It has all the spring goodies so porting my project
will be easy . Main reason for choosing blueprint was avoiding different
xml's for components and camel routes ,beans ..etc . while in blueprint i
can use all of them in one xml . 

-----
thanks
sanketh
mail : sanre6@gmail.com
--
View this message in context: http://camel.465427.n5.nabble.com/Questions-regarding-usage-of-camel-along-with-OSGI-Declarative-services-tp5556728p5560339.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Questions regarding usage of camel along with OSGI Declarative services ?

Posted by Christian Schneider <ch...@die-schneider.net>.
Camel has no special feature for declarative services it treats them as 
any other osgi service. So it does not matter if you specify your 
services using spring dm, blueprint or ds.

Camel resolves services using its internal registry. When inside OSGi 
this registry also looks up OSGi services. So when you use a bean in 
your route with a certain name then camel looks this
bean up in the OSGi service registry too. I am not sure though what 
exact filter criteria are used.

I think the cleanest way to use OSGi services in camel is to first add a 
service reference into the spring context. So the service is available 
as a bean in the spring context and then usse it like a normal bean in 
camel.

Btw. when in OSGi you should consider replacing spring dm with 
blueprint. It works much better in an OSGi environment. When using 
spring dm you often have to configure a lot of package imports or 
require bundle statements. In blueprint you normally do not need to 
define any as the maven bundle plugin figures them out itself and 
blueprint uses the classpath better and so needs less configs anyway.

Christian

Am 12.03.2012 07:08, schrieb sanketh.reddy:
> Hi,
>
>     i have a single monolithic project which has its components segregated by
> packages . i used a lot of spring xml's to define :
>
>
> 1. camel route's between these packages to send serialized java objects
> 2. create singleton instances with injected properties which took care of
> application lifecycle,
> 3. trigger some cron jobs on beans...etc .
>
>
> I deployed this project as a single osgi bundle in servicemix with no config
> admin,service dependency management..etc because it was a single bundle
> .Now, we have a new requirement where some of our packages need to be
> updated dynamically without bringing down the system .We have decided to
> embrace the osgi standard and divide our project into independent component
> bundles communicating via services .
>                                I have chosen osgi declarative services(felix
> SCR) as my service dependency manager as it very light compared to
> spring-DM(blueprint)  and provides most of the features i need . Moving to
> OSGI DS means writing your service implementation classes as components .
> Now , i want to keep my camel routes in spring xml and use some of the
> components as beans in my camel routes (static instances) . Will this cause
> any abnormal behaviour , how does camel context work along with the
> bundlecontext provided by OSGI . Are there any best practices to keep in
> mind when using camel with OSGI DS ?
>
>
> Thanks
> sanre6
>
>
>
> -----
> thanks
> sanketh
> mail : sanre6@gmail.com
> --
> View this message in context: http://camel.465427.n5.nabble.com/Questions-regarding-usage-of-camel-along-with-OSGI-Declarative-services-tp5556728p5556728.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


-- 

Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com