Running an autoscheduled task
Hi,
I am trying to create my own auto-scheduled task. I don't know how to run it. I've been searching through the source code but I can't find what I need.
I have these parts ...
and I am trying to get it scheduled from another service ...
I get an error that
I am thinking that maybe I need to register the task to get a component Id but I am not sure how. Assistance would be greatly appreciated!
I am trying to create my own auto-scheduled task. I don't know how to run it. I've been searching through the source code but I can't find what I need.
I have these parts ...
MyTask extends AbstractAutoScheduledTask
@Override
public String getTaskId() {
// TODO Auto-generated method stub
log.info("getTaskId");
return TASK_ID;
}
@Override
protected void runTask() throws TeamRepositoryException {
log.info("runTask");
//cancel it after I run it for testing
this.setCancelled(true);
}
and I am trying to get it scheduled from another service ...
//services needed
IAsynchronousTaskSchedulerService asynchTaskScheduleService = getAsynchTaskSchedulerService();
MyTask myTask = new MyTask();
// schedule/start task
String taskId = myTask.getTaskId();
String componentId = myTask.getComponentId();
asynchTaskScheduleService.schedule(componentId, taskId);
I get an error that
Failed to get the component id for service ...
I am thinking that maybe I need to register the task to get a component Id but I am not sure how. Assistance would be greatly appreciated!
One answer
Okay,
I think I am understanding this more now.
AsynchronousTasks
I need to specify my asynch task in plugin.xml following the example of ChangeEventScrubber.
Then I can schedule/unschedule it?
I think I am understanding this more now.
AsynchronousTasks
I need to specify my asynch task in plugin.xml following the example of ChangeEventScrubber.
Then I can schedule/unschedule it?