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:
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: