Description
Douglas C. Kaminsky opened BATCH-106 and commented
Request for 2 new interfaces to mirror Spring functionality:
InitializingTasklet: along the lines InitializingBean, defines a contract for some sort of init method which is called once at the beginning of the Step before execute is called for the first time
DisposableTasklet: along the lines of DisposableBean, defines a contract for some sort of destroy method which is called once at the end of the Step after execute is called for the last time
These should be auto-wired via reflection so that if I define a Tasklet which implements either or both of these interfaces, the appropriate method will be called automatically without further effort within the default executors.
Sample use cases: Opening/closing file handles, performing file copy/move/rename operations at the beginning or end of some processing
Existing solutions so far seem insufficient to handle this -
- write my own version of tasklet which wraps this and keys off of ExitStatus - this is a hack and non-uniform, which defeats the purpose of using Spring Batch
- use a RepeatInterceptor, which forces me to separate logic between the tasklet and the step execution instead of being centrally located - also, seems that I'd have to use a non-default StepExecutor to do this
- wire file handles in as beans - doesn't allow dynamic locating and opening of files
Possibly related issue: BATCH-45 (POJO adaptor)
Affects: 1.0-m2