This sample explains how to create a task that can be scheduled to run on WSO2 Governance Registry in few easy steps. Once successfully deployed this sample will print Hello World once every 10 seconds on the Command Prompt of the WSO2 Governance Registry. We will be reusing the code of the Handler Sample in this example. This sample requires Apache Maven. See Installation PrerequisitesSystem Requirements for links on how to install it.
...
Code Block | ||
---|---|---|
| ||
<dependency> <groupId>org.wso2.carbon.carbon<commons</groupId> <artifactId>org.wso2.carbon.ntask.core</artifactId> <version>4<version>${carbon.0commons.0<version}</version> </dependency> |
3. Add a new Java Class named SampleTask
at GREG_HOME/samples/handler/src/src/main/java/org/wso2/carbon/registry/samples/task/SampleTask.java
with the following source:
...
Info |
---|
The command |
...
5. Copy the <G-REG_HOME>/
samples/handler/src/target/
org.wso2.carbon.registry.samples.handler-5.23.0.jar
file into the <G-REG_HOME>/repository/components/dropins/
directory.
...