Being a newbie, having hard time in connecting to two different clusters from spring boot application. Task is to get the data from cassandra on ec2(I am able to do that) and insert in batches in AWS keyspace.
Here I am overriding the customize method and when trying to connect to cassandra ec2 cluster things working fine but also need to have one more cluster for connecting to AWS Keyspaces(select data from cassandra and insertion needs to happen in AWS Keyspace).
Problem is - When I am overriding the customize method for creating cluster for AWS Keyspace, instead of new cluster creation contact point gets added to previously created cluster.
Any help would be highly appreciated. Thanks!
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.5.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-cassandra</artifactId> </dependency>
@Component public class CassandraClusterConfig implements ClusterBuilderCustomizer { @Override public void customize(Cluster.Builder clusterBuilder) {
cassandra-driver.version = 3.6.0
<dependency> <groupId>com.datastax.cassandra</groupId> <artifactId>cassandra-driver-extras</artifactId> <version>${cassandra-driver.version}</version> </dependency> <dependency> <groupId>com.datastax.cassandra</groupId> <artifactId>cassandra-driver-mapping</artifactId> <version>${cassandra-driver.version}</version> </dependency>