AbNig
AbNig

Reputation: 352

Read a file with repeating batches Using Spring Batch

We have as clob object in the database which has repeating batches which is identified by the record marker '5'. Each '5' type record has a list of transaction record which have record marker as '6'. I am thinking of using Spring Batch to read the clob object.

I am aware Matching Pattern Parser, which Spring batch provide. I need help on how to structure the batch job so that it can read the the record type 5 & record type 6 in loop.

Upvotes: 0

Views: 264

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31730

Clearly you need a custom item reader for this kind of input. You can use the SingleItemPeekableItemReader to look ahead if the upcoming item is of type 5 and add the following transactions to the clob. Since a logical item spans multiple physical lines, you can follow the same idea as these examples:

Hope this helps.

Upvotes: 1

Related Questions