使用WSO2Developer Studio version 3.8.0 如何编写Custom Task Class

Using WSO2Developer Studio version 3.8.0 How can write Custom Task Class

我正在使用 WSO2Developer Studio 3.8.0 版。我要编写自定义任务 class 以下是步骤: 1. 我创建了以下内容 class

package com.training.mediators;

import org.apache.synapse.ManagedLifecycle;
import org.apache.synapse.core.SynapseEnvironment;
import org.apache.synapse.startup.Task;


@SuppressWarnings("deprecation")
public class CronjobTask implements Task,ManagedLifecycle{  

    @Override
    public void destroy() {
        // TODO Auto-generated method stub

    }

    @Override
    public void init(SynapseEnvironment arg0) {
        // TODO Auto-generated method stub
        System.out.println("CronjobTask init method****************");
    }

}


2. When i import the org.apache.synapse.startup.Task Developer studio shows that it is deprecated.
3. How can i implement the method  execute() of the Task interface.If it is deprecated.

请指导我做错了什么。

您的自定义任务应该实现 org.apache.synapse.task.Task,而不是 org.apache.synapse.startup.Task