Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Batch Status and Exit Status in Spring Batch

Difference between Batch Status and Exit Status in Spring Batch

like image 332
Sravan Kumar Avatar asked Dec 09 '13 05:12

Sravan Kumar


People also ask

How do I exit Spring Batch?

You can wait until, according to your code, all the required jobs are complete, and then close the application, eg: applicationContext. close() .

What is ExecutionContext in Spring Batch?

An ExecutionContext is a set of key-value pairs containing information that is scoped to either StepExecution or JobExecution . Spring Batch persists the ExecutionContext , which helps in cases where you want to restart a batch run (e.g., when a fatal error has occurred, etc.).

Can we have multiple steps in Spring Batch?

The second model can be seen when you read the article named "SPRING BATCH: Write data to a H2 database". We can have sequential steps and parallel steps. We can execute some tasks (steps) when a condition is true or false. Because of these things, you can create workflows using Spring Batch.

What is chunk in Spring Batch?

Spring Batch uses a 'Chunk-oriented' processing style within its most common implementation. Chunk oriented processing refers to reading the data one at a time and creating 'chunks' that are written out within a transaction boundary.


1 Answers

From the Spring Batch documentation:

A BatchStatus object that indicates the status of the execution. While running, it's BatchStatus.STARTED, if it fails, it's BatchStatus.FAILED, and if it finishes successfully, it's BatchStatus.COMPLETED

The ExitStatus indicating the result of the run. It is most important because it contains an exit code that will be returned to the caller.

For more on the difference, see the section 5.3.2.1. Batch Status vs. Exit Status. You will find the explanation is quite good.

like image 119
Vidya Avatar answered Oct 06 '22 16:10

Vidya