Solved
Hope this info will be useful for others. Second part of my question "is it possible to convert a synapse scheduler task into an osgi bundle" is the real question and answer is yes. In wso2 you can write your own bundle and drop it to {carbon_server_path}/repository/component/dropins and when server start it installs the bundle. So here is some code snippets showing my implementation:
Task implementation
package com.fga.test.task;
import org.apache.synapse.task.Task;
public class ProcessChecker implements Task {
@Override
public void execute() {
//Check for processes and start them
}
}
Bundle Activator
package com.ardic.arcsp.cluster.task;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
/**
* Initializes process list from configuration file
*/
@Override
public void start(BundleContext context) throws Exception {
//Do some initialization
}
/**
* Stops all processes
*/
@Override
public void stop(BundleContext context) throws Exception {
//Get process list from config file and stop them
}
Activator start and stop call method will be called at server start and stop event respectively.
Note: Here maven bundle plugin is used for creating bundle and my work environment was WSO2 esb version 4.0.2