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 28, 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 conditions.

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

---
id: 1
name: hello world job
class: 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 method to execute should be public. This condition is also checked at server startup.

Clone this wiki locally