Use SB for this kind of problem is the right decision and you don't need more than a single step (for this use-case).
First solution:
Reader is trivial (use a StaxEventItemReader
) and processor is useless (except you need to perform some business check).
The more interesting point is the writer because you have to:
- Define a custom writer for each operation (
AddItemWriter, UpdateItemWriter, DeleteItemWriter
for example) where you perform the real write logic - Create a main writer (composed with specialized writer) where you dispatch writes to right writer based on
<ACTION>
tag value.
Second solution (maybe a bit more "complex"):
- Standard
StaxEventItemReader
- Custom
ItemProcessor
convert from<UserAuthorization>
to customAction
class encapsulate operation (AddUserAuth, DeleteUserAuth, UpdateUserAuth
for example) - Define a custom writer for each operation (
AddItemWriter, UpdateItemWriter, DeleteItemWriter
for example) where you perform the real write logic - As main writer use a
ClassifierCompositeItemWriter
based onSubclassClassifier
; this classifier dispatch to right writer using the class of customAction
created from processor
This solution is more (easily) extensible than solution one because you just need to create custom Action
class - and the right writer - for a (new) action and writing is just a configuration matter.