💻 Spring Batch Application to show like steps conditions ❓ work.
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
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.
- docker
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.
In the Command Prompt, run:
set FAIL_VALUE=
set FAIL_VALUE=1
set FAIL_VALUE=2
In the terminal, run:
export FAIL_VALUE=
export FAIL_VALUE=1
export FAIL_VALUE=2
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.
With the docker started, execute this command at the project root:
docker-compose up -d --build
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.
To stop correctly:
docker-compose down -v
Remember to execute this command each time that you want change the parameter value.
👤 Pedro Lucas
- Twitter: @PedroLucasOM
- Github: @PedroLucasOM
- LinkedIn: @PedroLucasOM
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐ if this project helped you!
Copyright © 2021 Pedro Lucas.