package com.caliverse.admin.domain.batch;

import org.springframework.batch.item.ItemReader;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CustomReader implements ItemReader<String> {
    private String[] tokens = { "Hello World!", "Hello Spring!", "Hello Batch!" };
    private int index = 0;

    @Override
    public String read() throws Exception {
        if (index >= tokens.length) {
            return null;
        } 
        
        String data = index + " " + tokens[index];
        index++;

        log.info("reading data: {}", data);  

        return data;
    }

}