Thanks Tim
Your reply gave me another dimension to look for creating a better architecture. In my PoC work, I wanted to check whether we can make an arrangement where BundleA (1.0) à BundleB (1.0) And BundleA(2.0) à BundleB(2.0) Which I could accomplish with service properties. But from your reply, I could make the application distributed among many instances of same service component. That will be good solution to be implemented for my application Regards, Jay Rajani From: [email protected] [mailto:[email protected]] On Behalf Of Timothy Ward Sent: Thursday, January 24, 2013 9:55 PM To: [email protected] Subject: RE: Need Help: Handling multiple versions of same service Do you want to pick just one of the services? Do you want access to both, but the option to choose which you use? Do you want the newer version to take precedence? The solution Emily suggests ties your blueprint to a particular version of the service. This may be what you want, but it will prevent you from being able to use any other version of the service. If you actually want to be able to pick the service you use then you need to use a reference list, not a reference. <reference-list id="greetService" interface="com.mii.greet.Greet" member-type="service-reference"/> This object will be of type: List<ServiceReference<Greet>> You can compare the service properties of the Service References to work out which one you want to use. Regards Tim Ward ------------------- Apache Aries PMC member & Enterprise OSGi advocate Enterprise OSGi in Action (http://www.manning.com/cummins) ------------------- _____ Date: Mon, 21 Jan 2013 23:02:09 +0000 Subject: Re: Need Help: Handling multiple versions of same service From: [email protected] To: [email protected] When you register the same service by a different versin of a bundle, you can specify a service property with a value (e.g. version=2.0) and then in your client bundle, you can search the service with filter attribute to get that matching service property. <reference id="accountRef" interface="org.apache.aries.simple.Account" component-name=myAccount filter=(version=2.0)/> Regards, Emily On Mon, Jan 21, 2013 at 1:11 PM, Jay Rajani <[email protected]> wrote: Hi, I am using Apache Aries on Karaf OSGi container. I have two different version of a bundle installed at a time. I have exposed service using <service> tag as following. <service ref="greetService" interface="com.mii.greet.Greet" /> On service consumer side, I refer to the service using reference tag. <reference id="greetService" interface="com.mii.greet.Greet" /> But on consumer side, I always receive the service provider from the bundle which exposes the service first. How can we refer to services provided by different versions of same bundle. Regards, Jay Rajani -- Thanks Emily ================= Emily Jiang [email protected]
