Skip to content

💻 Spring Batch Application to show like steps conditions ❓ work.

Notifications You must be signed in to change notification settings

PedroLucasOM/ConditionalSpringBatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo: ConditionalSpringBatch

Version documentation maintenance Twitter: PedroLucasOM

💻 Spring Batch Application to show like steps conditions ❓ work.

Topics

  1. About SpringBatch
  2. About the Project
  3. Author
  4. Contributing
  5. Show your support
  6. License

1. About SpringBatch

It is a framework that uses the Java Virtual Machine and the Spring Ecosystem to build batch applications. By definition, batch systems are systems that realize a process of a finite amount of data without interaction or interruption.

To learn more about this framework, view this article on the Notion: SpringBatch Article

2. About the Project

Implemented Job

It is a simple job that executes 5 steps according to the output of each step execution and the passed parameter before the execution.

There are 5 steps:

  • conditionalStep1
  • conditionalStep2
  • conditionalStep3
  • conditionalStep4
  • conditionalStep5

The application stats with the step conditionalStep1.

  • If the FAIL parameter value is 1, the next step to be executed is conditionalStep3.
  • Otherwise, if the FAIL parameter value is 2, the next step to be executed is conditionalStep4 and then conditionalStep5.
  • If the FAIL parameter value isn't setted (parameter value = null), the next step to be executed is conditionalStep2.

Prerequisites

  • docker

Configuration

To run this application, you need to set an environment variable called FAIL_VALUE with the value of the error you want to see in execution.
The possible values are: 1, 2 or empty.

Windows

In the Command Prompt, run:

set FAIL_VALUE=
set FAIL_VALUE=1
set FAIL_VALUE=2

Linux

In the terminal, run:

export FAIL_VALUE=
export FAIL_VALUE=1
export FAIL_VALUE=2

Mac

In the terminal, run:

touch ~/.bash_profile; open ~/.bash_profile

In TextEdit, add:

export FAIL_VALUE=
export FAIL_VALUE=1
export FAIL_VALUE=2

Save the .bash_profile file and Quit (Command + Q) Text Edit.

Run

With the docker started, execute this command at the project root:

docker-compose up -d --build

Usage

Seeing the results in the log

In the base directory of the project with application running in the docker, run:

docker-compose logs -f -t app

You will see the executed job according to each FAIL_VALUE value.

Stop

To stop correctly:

docker-compose down -v

Remember to execute this command each time that you want change the parameter value.

3. Author

👤 Pedro Lucas

4. Contributing 🤝

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

5. Show your support

Give a ⭐ if this project helped you!

6. License 📝

Copyright © 2021 Pedro Lucas.