...
- engine-job-api.jar
- The library is hosted on Maven Central. Please download the jar and add it to the classpath of the Java project.
- If your the Java project already is already a maven project, simply add the following dependency to the project configuration:.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dependency> <groupId>com.sos-berlin.jobscheduler.engine</groupId> <artifactId>engine-job-api</artifactId> <version>1.10.3</version> </dependency> |
- Make sure to use the correct version suitable for th the JobScheduler in use.
For this example the activemq-all-5.13.0.jar library is used.
- Either download the jar file and add it to your the classpath
- or in case of a maven project add the following dependency to the project configuration
...
The Basic Structure of an API Job Java Class
A Java Job using the JobScheduler API has to extend the Job_impl class.
It has to overwrite the method spooler_process()
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public class CLASSNAME extends Job_impl {
@Override
public boolean spooler_process() throws Exception {
// This is the place where the work is done!
return spooler_job.order_queue() != null;
}
} |
The Return Value of spooler_process()
If the Java job is an order job it has to return true
in case no error occurs for the order to be able to continue with the next task.
If the Java job is a standalone job it has to return false for the JobScheduler to be able to recognize the task has finished.
This can be achieved by using the return value spooler_job.order_queue() != null
. It determines if an order is in the queue of the job (true
) or not (false
).
Initialization of the MQ Connection
Both Java jobs need some methods to initialize a connection to an MQ Server. This section of the document shows how to implement them. The implementation is based on the JMS implementation used and shipped by activeMQ.
The createConnection()
method
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Implementation of the Producer Job
...