4 Replies Latest reply on Jan 1, 2015 10:50 AM by xkylex

    JSR 352 - Viewing batch jobs in admin console




      I'm looking for an easy way to view, run, restart my jobs (JSR 352) with Wildfly 8.

      It seems that Glassfish has this feature in the admin console (http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/1965492.gif), and Spring Batch had it too (Spring Batch Admin).


      Do you know if Wildfly will have soon a same page in its admin console ?





        • 1. Re: JSR 352 - Viewing batch jobs in admin console

          There is currently not a way to do that. It's been on the todo list, but hasn't happened yet. I did create a JIRA to track it though.


          That said it would be fairly easy to create a rest endpoint to at least view/list them. For tests I've done something like:

          package org.jboss.example.batch.rest;
          import java.util.ArrayList;
          import java.util.List;
          import java.util.Set;
          import javax.batch.operations.JobOperator;
          import javax.batch.runtime.JobExecution;
          import javax.batch.runtime.JobInstance;
          import javax.inject.Inject;
          import javax.ws.rs.GET;
          import javax.ws.rs.Path;
          import javax.ws.rs.Produces;
          import javax.ws.rs.core.MediaType;
          import javax.ws.rs.core.Response;
          import org.jboss.example.batch.common.BatchExecutionService;
          public class BatchResource {
              private BatchExecutionService service;
              public Response listBatchJobs() {
                  final List<JobExecutionEntity> executionEntities = new ArrayList<>();
                  final JobOperator jobOperator = service.getJobOperator();
                  final Set<String> names = jobOperator.getJobNames();
                  for (String name : names) {
                      final int end = jobOperator.getJobInstanceCount(name);
                      final List<JobInstance> jobInstances = jobOperator.getJobInstances(name, 0, end);
                      for (JobInstance jobInstance : jobInstances) {
                          final List<JobExecution> executions = jobOperator.getJobExecutions(jobInstance);
                          for (JobExecution execution : executions) {
                  return Response.ok(executionEntities).build();


          Then the simple bean

          package org.jboss.example.batch.rest;
          import java.util.Date;
          import java.util.LinkedHashMap;
          import java.util.Map;
          import java.util.Properties;
          import javax.batch.runtime.BatchStatus;
          import javax.batch.runtime.JobExecution;
          import javax.xml.bind.annotation.XmlAccessType;
          import javax.xml.bind.annotation.XmlAccessorType;
          import javax.xml.bind.annotation.XmlRootElement;
          public class JobExecutionEntity {
              private long id;
              private String name;
              private BatchStatus status;
              private String exitStatus;
              private Date createTime;
              private Date endTime;
              private Date lastUpdateTime;
              private Date startTime;
              private Map<String, String> properties;
              public JobExecutionEntity() {
              static JobExecutionEntity create(final JobExecution jobExecution) {
                  final JobExecutionEntity result = new JobExecutionEntity();
                  result.id = jobExecution.getExecutionId();
                  result.name = jobExecution.getJobName();
                  result.status = jobExecution.getBatchStatus();
                  result.exitStatus = jobExecution.getExitStatus();
                  result.createTime = new Date(jobExecution.getCreateTime().getTime());
                  result.endTime = new Date(jobExecution.getEndTime().getTime());
                  result.lastUpdateTime = new Date(jobExecution.getLastUpdatedTime().getTime());
                  result.startTime = new Date(jobExecution.getStartTime().getTime());
                  result.properties = new LinkedHashMap<>();
                  final Properties props = jobExecution.getJobParameters();
                  for (String name : props.stringPropertyNames()) {
                      result.properties.put(name, props.getProperty(name));
                  return result;
              public long getId() {
                  return id;
              public String getName() {
                  return name;
              public BatchStatus getStatus() {
                  return status;
              public String getExitStatus() {
                  return exitStatus;
              public Date getCreateTime() {
                  return createTime;
              public Date getEndTime() {
                  return endTime;
              public Date getLastUpdateTime() {
                  return lastUpdateTime;
              public Date getStartTime() {
                  return startTime;
              public Map<String, String> getProperties() {
                  return properties;


          James R. Perkins

          • 2. Re: JSR 352 - Viewing batch jobs in admin console

            Thanks for your answer and the JIRA, James.
            I will develop a small web app to list those jobs.

            • 3. Re: JSR 352 - Viewing batch jobs in admin console

              I'm developing such kind of a small web app.

              lbtc-xxx/jberetweb · GitHub



              If there are anyone know better one, I would be glad if you could share here.

              • 4. Re: JSR 352 - Viewing batch jobs in admin console