Ankur Saxena
Ankur Saxena

Reputation: 197

Pagination in SpringBatch ItemReader

I want to read data from an api endpoint using spring-batch .Is it possible for me to read the data in a paginated way. Example :-

Upvotes: 4

Views: 5977

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

Since your API already provides pagination, you can create a reader that extends AbstractPagingItemReader and implement the doReadPage method where you call the API to request a page of items (with a configurable size). If the endpoint is a REST endpoint, the reader can use a RestTemplate to make the call.

Upvotes: 6

Related Questions