Apache BatchEE provides a Web-UI and 2 different ways to expose Batch details via REST
For a quick out of the box solution to gather information about the JBatch environment you can use our Servlet based solution
org.apache.batchee.jaxrs.server.JBatchResourceImpl maps more or less javax.batch.operations.JobOperator API to JAXRS. It is available in batchee-jaxrs-server module.
To define it with CXF you can use the CXFNonSpringServlet in a servlet container, in a JavaEE container you surely already have it and just need to define a custom javax.ws.rs.core.Application with JBatchResource as class in getClasses and configure org.apache.batchee.jaxrs.server.JBatchExceptionMapper if you want to map javax.batch.operations.BatchRuntimeException to status 500:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>CXFServlet</servlet-name> <display-name>JBatch JAXRS Servlet</display-name> <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class> <init-param> <param-name>jaxrs.serviceClasses</param-name> <param-value>org.apache.batchee.jaxrs.server.JBatchResourceImpl</param-value> </init-param> <init-param> <param-name>jaxrs.providers</param-name> <param-value> org.apache.batchee.jaxrs.common.johnzon.JohnzonBatcheeProvider, org.apache.batchee.jaxrs.server.JBatchExceptionMapper </param-value> </init-param> <init-param> <param-name>jaxrs.extensions</param-name> <param-value>json=application/json</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> </web-app>
Note: instead of johnzon you can also use jackson as JAX-RS Json provider: com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Note: JohnzonBatcheeProvider is exactly the same as org.apache.johnzon.jaxrs.JohnzonProvider provider with org.apache.batchee.jaxrs.common.johnzon.TimestampAdapter registered to convert dates to timestamps. You can use Johnzon provider directly as well but the date conversion will be Johnzon one.
Here is the mapping:
Note: batchee-jaxrs-client provides a way to query it through the JobOperator API. You need to use org.apache.batchee.jaxrs.client.BatchEEJAXRSClientFactory.newClient(String url, Class<?> jsonProvider, API apiType). API.AUTO tries to use JAXRS 2 client and if not available uses cxf 2.6 clients. In this last case you need to provide cxf-rt-frontend-jaxrs.
It is based on org.apache.batchee.servlet.JBatchController but since the jar - batchee-servlet - is in a webapp in a servlet 3.0 container, it is automatically added and you don’t need to define it in your web.xml.
The configuration through init parameters is: