Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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 ...

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!

0 votes



One answer

Permanent link
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?

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,940

Question asked: Apr 13 '09, 8:26 p.m.

Question was seen: 4,667 times

Last updated: Apr 13 '09, 8:26 p.m.

Confirmation Cancel Confirm