Announcement Announcement Module
No announcement yet.
Switch bundle versions on the fly Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Switch bundle versions on the fly

    Hi *,

    Use case:
    I have 2 bundles: web and service.
    In service-bundle are running long-time processes which are started by call from web-bundle.
    Web-bundle should use newest service-bundle on a new request but should end all started processes with old service-bundle.

    Is it possible?
    Some doc references or examples?



  • #2
    Switch bundle versions on the fly

    Hi Roman,

    The use case you've described is somewhat atypical and therefore not supported by OSGi or Spring-DM out-of-the-box. So it's not possible without some custom coding of your own.

    By default, when you retrieve a service from the OSGi Service Registry, you'll get the one with the lowest service ID. That would be the first one created and obviously not what you're aiming for. In contrast, if you retrieve a list of services of a given type, you could programmatically traverse the list and use the one with the highest service ID. That would give you the newest service; however, to "end all started processes with [the] old service-bundle," you would have to manage that programmatically on your own as well.

    If you do not want to have multiple versions of the same service deployed simultaneously -- for example, if you deploy service bundle S1, undeploy S1, and then deploy service bundle S2 which publishes the same type of service as S1 -- then your consumer bundle C can use Spring-DM to obtain a reference to the service type published by bundles S1 and S2, and C will essentially be unaffected by the on-the-fly switch from S1 to S2.




    • #3
      Switch bundle versions on the fly

      Hi Sam,

      option 1 is possible (list of services of given type). But what I need is option 2.

      I evaluate S2AP for our printing server. When http request is comming service-bundle should generate logistic stickers.
      There can be more than 100. It takes time. If I deploy new version of service bundle the deployment process shouldn't prevent running generation of previously requested stickers.
      And I think it isn't possible to undeploy old service version at the moment where generation is running.

      I thought about ranking attribute in service tag. It would do the job too, but then I have to maintain ranking number and increase it on each new service version.