@Slf4j public class SimpleReader implements ItemReader<String> {
private ConcurrentLinkedQueue<String> queue;
public void init() { log.info("init simple reader..."); queue = new ConcurrentLinkedQueue<>(); queue.addAll(Arrays.asList( "message 1", "message 2", "message 3", "message 4", "message 5", "message 6", "message 7", "message 8", "message 9" )); }
@Override public String read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { return queue.isEmpty() ? null : queue.poll(); } }
|