I understand that Spring Batch has a Conditional Execution that can be configured to decide which step to go next based on the ExitStatus of the current step but…
-
what if I want my Spring Batch job to run a query which resultset I use to decide the value of a parameter in a query that I have in ItemReader is SpringBatch setup for that?
-
Or is Spring Batch framework going to “force” me to have a Processor and a Writer for that initial query?
If the answer to the second question is yes, how can it be handled?
thats quite easy, you can use a TaskletStep to run the query and use a “normal” Step (read: reader, writer, processors are optional) which uses some values provided by the TaskletStep.
To get the values from the first step to the latter, you can use late-binding of job/step attributes, see this stackoverflow question for interstep communication too.
For a “normal” Step a ItemReader and a ItemWriter are set, the ItemProcessor is optional.