I am playing with OSGI and have a few bundles. Bundle A and B both contain a registered service which implement a single interface. The third bundle C includes code to lookup a service implementing the previously mentioned interface. The A and B bundles have different version numbers however it appears that C picks up the service from the first started bundle. I have changed the start level to do the right thing but version is only used to accept rather than order which service is returned.
A version 1.0 start level 1
B version 1.1 start level 2
C requires both bundles, start level 3
In theee above example C always gets the service from A even though B has a higher bundle version. However if i switch the start level so B starts before A then C seens the B service.
I have searched the OSGI website and there is no clear explaination of whether versioning of a bundle is used to prioritise a service over another. My understanding seems to indicate that start level is supposed to be used to order bundle startup so that dependencies can be satisified correctly. However it appears to be overloaded so that it also prioritises service priority. Given allt he above i guess it makes sense not to use the bundle version in selection because the versionnumber is just a number relative to nothing.
What is the best way to prioritise one service over another, besides start level ?