This documentation is for WSO2 Data Services Server 3.2.2. View documentation for the latest release.
Page Comparison - Scheduling Tasks (v.17 vs v.18) - Data Services Server 3.2.2 - WSO2 Documentation

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The task scheduling configuration is a generic configuration, which is used by any component that requires the task scheduling functionality. Scheduled tasks support many modes of operations, where it fully supports load balancing and fail-over of tasks. The task configuration file can be found in the tasks-config.xml file stored in the <DSS_HOME>/repository/conf/etc/ directory. The default configuration is as follows: 

Code Block
<tasks-configuration xmlns:svns="http://org.wso2.securevault/configuration">
	<!-- The default location resolver configuration -->
    <!--remoteServerPassword svns:secretAlias="remote.task.server.password"></remoteServerPassword-->


  • <taskClientDispatchAddress>: The address to which the remote task server should dispatch the trigger messages. Usually this would be an endpoint to a load balancer.
  • The <remoteServerAddress>, <remoteServerUsername> and <remoteServerPassword> is used to specify the sever address, user name and password of the remote task handling server. That is, these settings are only applicable when the <taskServerMode> is REMOTE. For example, see how you can use WSO2 Task Server as a remote task server.


Follow the steps given below to schedule a task.

  1. Log in to the management console of the Data Services Server Management Console and select select Data Services > Scheduled Tasks in the Main menu.    
  2. The Scheduled Tasks window opens. Click Add New TaskFill the required information.

    You can configure a task to invoke a data service operation or to use a custom Java class that implements the org.wso2.carbon.dataservices.task.DataTask interface. To successfully create a task, provide the following set of properties:

    • Task Name : Name of the scheduled task
    • Task Repeat Count : Number of cycles to be executed. If you enter 0, the task will execute once. If you enter 1, the task will execute twice and so on.
    • Task Interval : Time gap between two consecutive task executions
    • Start Time : Starting time of the scheduled task. If this is not given, the task will start as soon as it is scheduled.

    Parameters required

    to define

    for defining a task that uses a data service operation:

    • Data Service Name : Name of the relevant data service.
    • Operation Name : Data service operation to be executed from the task.


      Note that only data services with HTTP endpoints are available when scheduling tasks to invoke data service operations. Also, you can use only operations with no input parameters when scheduling.

    Parameters required

    to define

    for defining a task that uses a custom java class:

    • Data Service Task Class : Name of the java class that implements org.wso2.carbon.dataservices.task.DataTask interface. The definition of the interface is as follows:

      Code Block
      package org.wso2.carbon.dataservices.task;
       * This interface represents a scheduled data task.
      public interface DataTask 
          void execute(DataTaskContext ctx);

      The following code snippet shows a sample DataTask implementation:

      Code Block
      package samples;
      import java.util.HashMap;
      import java.util.Map;
      import org.wso2.carbon.dataservices.core.DataServiceFault;
      import org.wso2.carbon.dataservices.core.engine.ParamValue;
      import org.wso2.carbon.dataservices.task.DataTask;
      import org.wso2.carbon.dataservices.task.DataTaskContext;
      public class SampleDataTask implements DataTask {    
         public void execute(DataTaskContext ctx) {
             Map<String, ParamValue> params = new HashMap<String, ParamValue>();
             params.put("increment", new ParamValue("1000"));
             params.put("employeeNumber", new ParamValue("1002"));
             try {
                 ctx.invokeOperation("RDBMSSample", "incrementEmployeeSalary", params);
             } catch (DataServiceFault e) {
               // handle exception