Versions Compared

Key

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

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 Installing Apache Maven for Governance Registry on Windows or Installing Apache Maven for Governance Registry on Linux.

Instructions

1. Navigate to GREG_HOME/samples/handler/src to find the source code of the Handler Sample.

...

Info
titleNote

The command mvn clean install will trigger an Apache Maven Build in your command line. This requires you having installed Apache Maven. See See Installing Apache Maven for Governance Registry on Windows or  or Installing Apache Maven for Governance Registry on Linux.

A successful run of Apache Maven will generate a report similar to the following:

...

Code Block
languagehtml/xml
<tasks>
    <task name="SampleTask" class="org.wso2.carbon.registry.samples.task.SampleTask">
        <trigger cron="0/10 * * * * ?"/>
    </task>
</tasks>

See also Configuration for Scheduled Tasks.

7. Start the server and observe the command prompt. See Starting Governance Registry Introducing the 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.

...

  • Schedule the generation of reports. See Reports.
  • Pre-fetching Governance Artifacts to a Global Cache to improve the speed of look-ups.

...