WebSphere Application Server

JSR-352 (Java Batch) Post #54: JobOperator Functions via the REST interface

By David Follis posted Wed August 07, 2019 09:03 AM

  
This post is part of a series delving into the details of the JSR-352 (Java Batch) specification. Each post examines a very specific part of the specification and looks at how it works and how you might use it in a real batch application.

To start at the beginning, follow the link to the first post.

The next post in the series is here.

This series is also available as a podcast on iTunesGoogle PlayStitcher, or use the link to the RSS feed
-----

In talking about the batch REST API we often wave our hands around and make it sound like it is just a wrapper around the JobOperator API.  But it isn’t.  In fact, it is an entirely separate interface that happens to include some of the same capabilities as JobOperator.

JobOperator has a whole set of methods that allow you to get back information about jobs known to the Job Repository.  You ask for it in various ways:  by jobname, by instance id, and by execution id.  In general, these methods return objects.  If you ask for the Job Instance for a specific job execution id you are given the JobInstance object for that job.  The object implements the JobInstance interface with a set of available methods.

The REST API has similar GET operations that let you access instances, executions, and step executions.  Instead of returning objects, the REST interface naturally returns JSON strings that include the information about the returned thing that you would have gotten via the object returned by the JobOperator API.  Thus, instead of a JobInstance object you would get a JSON string with all the information we have about the Job Instance. 

The REST interface has a lot of filters that aren’t available through the JobOperator API.  You can search for jobs by id, of course.  But you can also search by created time, last updated time, batch status, exit status, application name, submitter id, and even for job parameters with a particular value.  That last one allows you to find all the jobs which were submitted with a particular name/value parameter pair such as JOBCLASS=A. 

The REST API also provides equivalent functions for the more operational aspects of JobOperator.  These include the start, stop, and restart functions.  The REST API does not provide an equivalent to the JobOperator abandon function. 

Finally, there’s a really important feature of the batch REST API that isn’t available to JobOperator.  We’ll talk about that one next time.

0 comments
18 views

Permalink