This topic describes the process of submitting a task to a configured scheduler.
Once you have developed a TaskInfo object that contains all relevant data for a task, submit the task to a scheduler for creation. When the task is created, the scheduler runs it.
// Create the TaskInfo using the Scheduler that you already looked up and print out the Task ID TaskStatus ts = scheduler.create(taskInfo); System.out.println(“Task created with id: “ + ts.getTaskId()”You can also create the task using the wsadmin tool as shown in the following JACL scripting example:
# Create the TaskInfo using the WASScheduler MBean that you previously located and print out the Task ID puts "Creating the task..." set params [java::new {java.lang.Object[]} 1] $params set 0 $taskInfo set sigs [java::new {java.lang.String[]} 1] $sigs set 0 com.ibm.websphere.scheduler.TaskInfo set taskStatus [java::cast com.ibm.websphere.scheduler.TaskStatus [$AdminControl invoke_jmx $schedO create $params $sigs]] puts "Task Created. TaskID= [$taskStatus getTaskId]" puts $taskStatus
When the call to the create() method is complete, the task exists in the persistent store and is run at the time specified in the TaskInfo object. If a global transactional context is present on the thread, and the create() transaction rolls back or is aborted, the task does not run.
The TaskStatus object, which has been returned by the call to the create() method, contains information about the state of the task, as well as the task ID. The task ID is the unique identifier for this task, and is required if the task is to be suspended, resumed, cancelled, and so on, at a later time.
In this information ... | IBM Redbooks, demos, education, and more |