0

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...

  1. 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?

  2. 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?

Viriato
  • 2,981
  • 7
  • 40
  • 54

1 Answers1

2

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.

Community
  • 1
  • 1
Michael Pralow
  • 6,560
  • 2
  • 30
  • 46