In this self-paced tutorial you will learn how to build, deploy, and execute Java batch application using JBeret and WildFly for OpenShift.
Batch processing is typically bulk-oriented, non-interactive, background execution. It usually involves large volume of data or intensive computation. It is used across many industries to tackle tasks like data ETL (extract, transform and load), recurring account statement generation, periodic security scanning, financial portfolio analysis, etc.
The sample batch application demonstrates basic batch processing operations, such as
- composing a job with both batchlet step and chunk step
- chunked reading and writing with transaction checkpointing
- start/restart/stop/abandon/schedule job executions
- list job and step execution details and status
Before you get started
If you are not familiar with the OpenShift Container Platform, it's worth taking a few minutes to understand the basics of the platform as well as the environment that you will be using for this self paced tutorial. Head on over to Learning OpenShift - Getting Started.
About project JBeret
Project JBeret implements JSR 352 (Batch Applications for the Java Platform), and additional advanced batch processing features in both Java SE and Java EE environment. JBeret is included in WildFly and JBoss EAP to provide enterprise batch processing capability.
When using the OpenShift Container Platform there are various ways to deploy a batch application:
- Deploy batch application from an existing Docker-formatted image.
- Build application locally and push the build result into OpenShift using a Binary strategy with the Source-to-Image (S2I) builder.
- Build and deploy from source code contained in a Git repository using a S2I builder.
For our introductory lesson we are going to use OpenShifts S2I repository builder to pull in, build and deploy a Java batch application to WildFly runtime. So let's get started!
Congratulations! You just finished learning how to deploy and run your own Java batch application on OpenShift. Pretty simple isn't it?
Now you are probably interested in expanding your work with OpenShift in a less structured environment. You can start with setting up your own OpenShift environment if you haven't already or if you have maybe expanding on what you have learned to build your own Java EE batch applications. For hints and ideas of where to start next check out the resources below.
- Sample Application Used in this Course
- Project JBeret Github Source Repository
- Project JBeret Community Forum
- Project JBeret JIRA Issues
- WildFly JSR 352 Batch Subsystem Configuration
- Project JBeret Docs
- JSR 352 : Batch Applications for the Java Platform Spec
OpenShift Development Tooling:
Minishift is a complete OpenShift environment that you can run on your local machine.
The project supports Windows, OS X, and the Linux operating system. To find more about Minishift, visit https://www.openshift.org/minishift/
- oc cluster up oc cluster up is a command provided by the oc client tool. It configures and runs an OpenShift environment running inside of the native docker system for your operating system. It supports Windows, OS X, and the Linux operating systems. For more information, visit https://docs.okd.io/latest/getting_started/administrators.html
OpenShift S2I References:
Java EE Batch Processing with OpenShift, WildFly & JBeret
Step 1 - Create an Initial Project
To get started, first we need to login to OpenShift.
To login to the OpenShift cluster use the following command in your Terminal:
oc login -u developer -p developer
This will log you in using the credentials:
You should see the output:
Login successful. Now we need to create a Project space in OpenShift for our API. In OpenShift we can create a new project by running oc new-project <projectname>
For out project let's create a project called
jberet-lab by running the command:
oc new-project jberet-lab
You should see output similar to:
Now using project "jberet-lab" on server "https://172.17.0.41:8443". You can add applications to this project with the 'new-app' command. For example, try: oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git to build a new example application in Ruby.
We are not going to use the web console for this course, but if you want to check anything from the web console, switch to the Dashboard and use the same credentials to login as you used above to login from the command line.