It's all about the answers!

Ask a question

Running an autoscheduled task


John Doran (9182) | asked Apr 13 '09, 8:26 p.m.
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 ...

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



permanent link
John Doran (9182) | answered Apr 13 '09, 9:31 p.m.
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?

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.