...
3. Add a new Java Class named SampleTask
to at GREG_HOME/samples/handler/src/src/main/java/org/wso2/carbon/registry/samples/task/SampleTask.java
with the following source code.:
Code Block | ||
---|---|---|
| ||
package org.wso2.carbon.registry.samples.task; import org.wso2.carbon.ntask.core.Task; import java.util.Map; public class SampleTask implements Task { public void setProperties(Map<String, String> stringStringMap) { } public void init() { } public void execute() { System.out.println("Hello World"); } } |
...
A successful run of Apache Maven will generate a report similar to the following:
5. Copy the GREG_HOME/
samples/handler/src/target/
org.wso2.carbon.registry.samples.handler-4.5.0.jar
into GREG_HOME/repository/components/dropins
.
6. Edit the registry.xml
file which is in GREG_HOME/repository/conf
folder with and add the following XML snippet.
Code Block | ||
---|---|---|
| ||
<tasks> <task name="SampleTask" class="org.wso2.carbon.registry.samples.task.SampleTask"> <trigger cron="0/10 * * * * ?"/> </task> </tasks> |
See also Configuring also Configuration for Scheduled Tasks.
7. Start the server and observe the command prompt. See Starting Governance Registry Management Console on Windows or Starting Governance Registry Management Console on Linux.
You should find a line similar to the following printed on your command prompt, which indicates that you task has successfully deployed.
...