Search code examples
osgiquartz-schedulerapache-servicemix

how to schedule an osgi bundle in fuse servicemix?


i want to restart an osgi bundle at a particular time for the day .i am using apache-servicemix-4.3.0-fuse-02-00.

console wise i want to do this . if my bundle id is 210

osgi:stop 210

osgi:start 210

how can i schedule this ?


Solution

  • If your servicemix has ssh console enabled you could use:

    ssh smx@IP_TO_FRAMEWORK -p 8101 osgi:stop 210
    ssh smx@IP_TO_FRAMEWORK -p 8101 osgi:start 210
    

    However, you need to insert the password for the smx user here... I've not found how to use a key-base authentication here. (ssh-copy-id does not work..)

    An other solution would be to drop the bundle into the deploy directory. Probably a simple touch would be enough. (I do not know, if changing the timestamps would be enough to trigger a re-installation.)

    And a third option: Writing a bundle which will start/stop the other bundle, given a Java Timer which will perform the restart task once a day...

    But you should check if you could not change the bundle, so it does not require a daily reboot.