Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

job definition

Mahmoud Ben Hassine edited this page Jun 23, 2017 · 4 revisions

Jobs in Easy Jobs are regular Java classes. Here is a job example:

public class HelloWorldJob {

    private String name;

    public void doWork() {
        System.out.println("Hello " + name);
    }

    // getter and setter for name
}

There is no annotation to add, no interface to implement or class to extend. Jobs are simple POJOs. Easy Jobs requires jobs to provide a default constructor and a setter for each parameter. A validation is done at server startup to check these two conditions.

Jobs are defined in a job descriptor file having the following JSON format:

[
    {
      "id": 1,
      "name": "Hello World Job",
      "class": "org.mycompany.jobs.HelloWorldJob",
      "method": "doWork"
    }
]

This job descriptor gives Easy Jobs all required information to identify your job and execute it when requested. The job identifier should be unique. Easy Jobs could have generated this id for you, but we want you to assign this id to be easier for you to remember. Make sure identifiers are unique.

the job class should in the server's classpath. The method to execute should be public. These conditions are also checked at server startup.

Clone this wiki locally