https://docs.spring.io/spring-batch/docs/current/reference/html/domain.html#jobrepository
The Domain Language of Batch
To any experienced batch architect, the overall concepts of batch processing used in Spring Batch should be familiar and comfortable. There are “Jobs” and “Steps” and developer-supplied processing units called ItemReader and ItemWriter. However, be
docs.spring.io
틀린 해석이 있다면 알려주세요 ☘️
JobRepository
JobRepository는 앞에서 언급한 모든 stereoType에 대한 지속성(persistence) 메커니즘이다.
JobLauncher, 작업 및 단계 구현을 위한 CRUD 작업을 제공한다. 작업이 처음 시작되면 저장소에서 JobExecution을 가져온다. 또한 실행 과정에서 StepExecution 및 JobExecution 구현은 리포지토리에 전달되어 유지된다
<job-repository id="jobRepository"/>
When using Java configuration, the @EnableBatchProcessing annotation provides a JobRepository as one of the components that is automatically configured.
JobLauncher
JobLauncher는 다음 예제와 같이 주어진 JobParameters 집합으로 Job을 시작하기 위한 간단한 인터페이스를 나타낸다
public interface JobLauncher {
public JobExecution run(Job job, JobParameters jobParameters)
throws JobExecutionAlreadyRunningException, JobRestartException,
JobInstanceAlreadyCompleteException, JobParametersInvalidException;
}
JobRepository에서 JobExecution을 얻어서 작업을 실행하는 구현
ItemReader
ItemReader is an abstraction that represents the retrieval of input for a Step, one item at a time. When the ItemReader has exhausted the items it can provide, it indicates this by returning null. You can find more details about the ItemReader interface and its various implementations in Readers And Writers.
ItemWriter
ItemWriter is an abstraction that represents the output of a Step, one batch or chunk of items at a time. Generally, an ItemWriter has no knowledge of the input it should receive next and knows only the item that was passed in its current invocation. You can find more details about the ItemWriter interface and its various implementations in Readers And Writers.
ItemProcessor
ItemProcessor is an abstraction that represents the business processing of an item. While the ItemReader reads one item, and the ItemWriter writes one item, the ItemProcessor provides an access point to transform or apply other business processing. If, while processing the item, it is determined that the item is not valid, returning null indicates that the item should not be written out. You can find more details about the ItemProcessor interface in Readers And Writers.
Batch Namespace
Many of the domain concepts listed previously need to be configured in a Spring ApplicationContext. While there are implementations of the interfaces above that you can use in a standard bean definition, a namespace has been provided for ease of configuration, as the following example shows:
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch
https://www.springframework.org/schema/batch/spring-batch.xsd">
<job id="ioSampleJob">
<step id="step1">
<tasklet>
<chunk reader="itemReader" writer="itemWriter" commit-interval="2"/>
</tasklet>
</step>
</job>
</beans:beans>
As long as the batch namespace has been declared, any of its elements can be used. You can find more information on configuring a Job in Configuring and Running a Job. You can find more information on configuring a Step in Configuring a Step.
'Web > spring' 카테고리의 다른 글
[Spring Batch] Configuring and Running a Job - (2) Java Configuration (0) | 2023.03.16 |
---|---|
[Spring Batch] Configuring and Running a Job - (1) Configuring a Job (0) | 2023.03.14 |
[Spring Batch] The Domain Language of Batch - (3) ExecutionContext (0) | 2023.03.12 |
[Spring Batch] The Domain Language of Batch - (2) Step (0) | 2023.03.12 |
[Spring Batch] The Domain Language of Batch - (1) Job (0) | 2023.03.11 |