Using Spring Batch to write to a Cassandra Database -


as of now, i'm able connect cassandra via following code:

import com.datastax.driver.core.cluster; import com.datastax.driver.core.session;  public static session connection() {     cluster cluster = cluster.builder()         .addcontactpoints("ip1", "ip2")         .withcredentials("user", "password")         .withssl()         .build();     session session = null;     try {         session = cluster.connect("database_name");         session.execute("cql statement");     } {         ioutils.closequietly(session);         ioutils.closequietly(cluster);     }     return session; } 

the problem need write cassandra in spring batch project. of starter kits seem use jdbcbatchitemwriter write mysql database chunk. possible? seems jdbcbatchitemwriter cannot connect cassandra database.

the current itemwriter code below:

@bean public jdbcbatchitemwriter<person> writer() {     jdbcbatchitemwriter<person> writer = new jdbcbatchitemwriter<person>();     writer.setitemsqlparametersourceprovider(new          beanpropertyitemsqlparametersourceprovider<person>());     writer.setsql("insert people (first_name, last_name) values          (:firstname, :lastname)");     writer.setdatasource(datasource);     return writer; } 

spring data cassandra provides repository abstractions cassandra should able use in conjunction repositoryitemwriter write cassandra spring batch.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -