Spring XD Batch Job – How to Start

The Spring XD provides a one stop shop for Bigdata solution, is a unified, distributed, and extensible service for data ingestion, real time analytics, batch processing, and data export. The tutorial will guide you how to create a Batch Job Application with Spring XD.

Related Articles:
Spring XD Stream – How to start with Stream

I. Technologies for Spring XD tutorial

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring XD: 1.3.1.RELEASE

II. Overview
1. Structure of Project

sping xd structure-of-project

2. Step to do

– Create Java Simple Spring Maven project.
– Add spring xd dependencies
– Implement a Tasklet for Batch Job
– Create batch-job configuration file
– Download Spring XD
– Start spring xd with xd-singlenode
– Register a Batch Job Module
– Deploy and Launch Job.

III. Practices
1. Create Java Simple Spring Maven project.

– Open Spring Tool Suite, on main menu, choose File->New->Spring Legacy Project, create a Simple Spring Maven

2. Add spring xd dependencies

Open pom.xml file Spring Xd dependency:

3. Implement a Tasklet for Batch Job

4. Create batch-job configuration file

Create a batchjob configuration file at: src/main/resources/config

5. Download Spring XD

– Download Spring Xd from: spring-xd-1.3.1.RELEASE.zip

– UnZip file spring-xd-1.3.1.RELEASE.zip

6. Start spring xd with xd-singlenode

Open a CMD
Go to: ./spring-xd-1.3.1.RELEASE\xd\bin
Run xd-singlenode

start spring xd singlemode

7. Register a Batch Job Module

– Build Spring Project, we have a jar file: SpringXDJob-0.0.1.jar, assume we place jar file at:
Open a CMD
Go to: .\spring-xd-1.3.1.RELEASE\shell\bin
Run xd-shell
Then run command: module upload –file C:\Users\Loi\SpringXDJob-0.0.1.jar –name hellospringxd-batchjob –type job

register-spring xd-module

8. Deploy and Launch Job.

Now go to http://localhost:9393/admin-ui/#/jobs/modules, we have module hellospringxd-batchjob

Click on Create Definition label, We go to: Create Definition page for Module hellospringxd-batchjob. Input Definition Name: Hellospringxd-BatchJob, then press Submit button.

Go to Definition tab, Now Hellospringxd-BatchJob is deployed:

Go to Deployments tab, press Launch button, then add Param, then press Launch Job as below Image:

Go to cmd of xd-singlenode, we see logs:

spring xd logs

Go to Executions tab, we see status COMPLETED of the job: Hellospringxd-BatchJob.

spring xd execution-completed

IV. Source code


By grokonez | September 18, 2016.

Last updated on June 9, 2017.

Related Posts

2 thoughts on “Spring XD Batch Job – How to Start”

  1. Can Spring XD resist the password changes meaning
    If the XD is up and running and I change the DB password and rerun the job then
    I want it to consider the updated password .Is that possible using XD ,If yes then how can we achieve it?
    Because I tried this scenario, where I rerun the job but XD did not responded in fact the job failed after the password change!

Got Something To Say:

Your email address will not be published. Required fields are marked *