Using Batch API with JBoss EAP 6

Today I’m going to demonstrate how to run the Batch API on JBoss EAP 6. As you probably know, Jboss EAP 6 (and AS 7) features the Java EE 6 API which does not include the Batch API, that is part of Java EE 7.

In order to run the Batch API on JBoss EAP 6 we need to patch the installation of the application server by downloading the backport of Batch API subsystem to available at: https://github.com/fcorneli/jberet-eap6

  • Download the latest dist (http://www.e-contract.be/maven2/org/jberet/eap6/eap6-batch-dist/1.0.2/eap6-batch-dist-1.0.2.zip)
  • Unzip it under the modules folder of JBoss EAP 6
  • Modify the modules/system/layers/base/javaee/api/main/module.xml:

Include the following dependency:

<dependencies>
	
...
	
   <module name="javax.batch.api" export="true"/>
</dependencies>

We need to create a configuration ad hoc (or simply change one of your existing configurations):

Create a copy of your configuration file (e.g. standalone.xml):

cp standalone.xml standalone-batch.xml

Now add the batch extension at the top of it:

<extensions>

...

    <extension module="org.wildfly.extension.batch"/>

</extensions>

Next, within your profile (I’ve added it at the beginning) add the batch subsystem:

<subsystem xmlns="urn:jboss:domain:batch:1.0">
	<job-repository>
		<jdbc jndi-name="java:jboss/datasources/ExampleDS"/>
	</job-repository>
	<thread-pool>
		<max-threads count="10"/>
		<keepalive-time time="30" unit="seconds"/>
	</thread-pool>
</subsystem>

Now start the application server:

standalone.sh -c standalone-batch.xml

Now connect to the CLI and verify that the subsystem batch is available:

[standalone@localhost:9999 /] /subsystem=batch:read-resource
{
    "outcome" => "success",
    "result" => {
        "job-repository-type" => "jdbc",
        "job-repository" => {"jdbc" => undefined},
        "thread-factory" => undefined,
        "thread-pool" => {"batch" => undefined}
    }
}

Congratulations! You have successfully patched EAP 6 to run the Batch API!


Recommended Articles

Learn New Quartz 2 API with JBoss EAP or WildFly - Step-by-Step Tutorial

Discover how to set up and use Quartz 2 API with JBoss EAP/WildFly. Includes simple Web application deployment and advanced JDBC Job Store configuration.

Windup: Migrate Your JBoss EAP 7 Application to JBoss EAP 8 with Detailed Reports and Migration Steps

Learn how to use Windup for a migration report from JBoss EAP 7 to JBoss EAP 8. #Java #Middleware #CloudNative

Deploying Java Web Start Applications on WildFly/JBoss EAP 8

Learn how to deploy Java Web Start applications on WildFly/JBoss EAP 8 with this step-by-step guide.

Choosing the Right JDK for WildFly and JBoss EAP: A Comprehensive Guide

Which Java version should you use for WildFly and JBoss EAP? Check our JDK compatibility guide for WildFly 35+ & EAP 8.x to choose between Java 17, 21 & 25.