Spring Batch Fundamentals Flashcards
(20 cards)
What is Spring Batch?
A lightweight framework for processing large datasets in batch mode.
What are the main components of a Spring Batch job?
Job, Step, ItemReader, ItemProcessor, ItemWriter, JobRepository, JobLauncher
What is a JobRepository?
A component responsible for storing job execution metadata.
What is a JobLauncher?
It is used to start jobs, typically triggered by an external event.
What is an ItemReader?
It reads input data from a source such as a file, database or message queue.
What does an ItemProcessor do?
It transforms or processes data before it is written.
What is an ItemWriter?
It writes processed data to a target, such as a file, database or API.
What is a JobInstance?
A uniquely identified execution of a job with a specific set of parameters.
What is a JobExecution?
A single execution attempt of a job instance, storing status and metadata.
What is a StepExecution?
A single execution attempt of a step, storing step-specific metadata.
What is the default batch metadata schema in Spring Batch?
A set of database tables (BATCH_JOB_INSTANCE, BATCH_JOB_EXECUTION, etc.) used to track job execution.
How do you initilize Spring Batch’s metadata schema?
By setting spring.batch.initilize-schema=always in application.properties.
What happens if a job is executed with the same parameters?
Spring Batch treats it as the same JobInstance and does not re-run it unless it is restartable.
How does Spring Batch handle job restarts?
It resumes from the last successful step execution recorded in the database.
What is an ExecutionContext in Spring Batch?
A key-value store that holds data for a job or step execution.
How can you store custom data in ExecutionContext?
By using StepExecution.getExecutionContext().put(“key”, “value”).
What is JobParametersIncrementer?
A strategy to generate unique job parameters for each job execution.
What is JobOperator in Spring Batch?
A management interface to start, stop, and restart jobs programmatically.
How can you programmatically stop a running job?
By using JobOperator.stop(jobExecutionId).
What is JobExplorer?
A read-only interface for retrieving job execution metadata.