开发者

Spring batch: chaining reader.processor, reader for the same initial data?

I am new to spring batch and researching the technology for some background processing project. I have gone through the doc but not sure it answers my question. So I need to chain the following for the same "stream" of data. read in , validate/pr开发者_C百科ocess, and reread for new data(basically piping the same data though multiple readers sandwiched by a processor . I am not sure if I am expressing myself but may be it is clear. I know I can do multiple reads but not sure if injecting the processor is viable Any ideas, opinions,etc Thanks


Instead of trying to do multiple reads you should consider chaining item processors after a single read before the final write.

The reason for this suggestion is chaining item processors allows you to take input, act upon it, transform it, and pass it along to the next processor in the chain.

Take a look at the section 6.3.1. Chaining ItemProcessors in the Spring Batch documentation for more information and some simple examples.


In Spring Batch terms the "piping the same data though multiple readers sandwiched by a processor" sounds like you need a job with several steps chained one after another.

If in turn you want to feed the items (messages) obtained on one step to the next reader/processor/writer for further processing then you might be building a Message Driven Application and the Spring Integration might be a more natural choice to achieve the goal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜