I have a spring batch job where the ItemWriter posts to a web service. I have an input file that I must transform and post to a web service, I do not have direct access to the database.
My question is, how should I handle failure responses from the web service? For example, if i am processing a record and I send it to the web service, but the web service responds, 'Failure - can't find that id' How should I record that this record failed (in a business sense) in spring batch? I was hoping to throw a skippable exception, so that in Spring Batch Admin a write skip would be recorded, but I see when I throw an error from the item writer, the chunk is automatically rolled back. And then when the chunk is reprocesses, records get sent to the web service for a second time.
What's the recommendation on this kind of scenario? Something like send the bad record to another item writer that records it in a separate place? Or is there a way to record it as write skip without rolling back? I realize this may be a larger architecture problem in our application and am open to suggestions.
thanks!