0
votes

I'm trying to change existing spring batch job(XML config) which reads data from oracle database and write into txt AND XML file in required format but now I want to change same implementation to read data from Cassandra database instead of oracle but I don't see any Item Reader available similer to JdbcCursorItemReader in spring batch for Cassandra db.

Can someone tell me which ItemReader should i use to read data from Cassandra db? OR Do I need to create a custom ItemReader to read data from Cassandra db?

1

1 Answers

0
votes

You can create a CustomItemReader

public class CustomItemReader implements ItemReader<List<YOUR_DOMAIN_OBJECT>> {

    @PostConstruct
    public void init() throws IOException {
        //establish cassandra db connection
    }

    @Override
    public List<YOUR_DOMAIN_OBJECT> read()
        throws Exception{

        //user cassandra connection to read data and build List<YOUR_DOMAIN_OBJECT>

       return data;
    }

}