From d454c1d98e7493d43964727eddce8be05f8d931a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Wed, 27 May 2026 10:14:56 +0200 Subject: [PATCH] Upgrade Cassandra driver and update example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cassandra driver has been relocated (2 times!) and the APi has been modified. there is no more Cluster, all is coming from the top-lvel CqlSession directly * update command inreadme to avoid: error: exec [POD] [COMMAND] is not supported anymore. Use exec [POD] -- [COMMAND] instead this is still not working, when following the steps, in the pod there is this error: ``` Failed to pull image "example/camel-example-cassandra-kubernetes:latest": Error response from daemon: pull access denied for example/camel-example-cassandra-kubernetes, repository does not exist or may require 'docker login': denied: requested access to the resource is denied ``` Signed-off-by: Aurélien Pupier --- cassandra-kubernetes/README.adoc | 2 +- cassandra-kubernetes/pom.xml | 6 +++--- .../camel/example/kubernetes/jkube/CqlPopulateBean.java | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cassandra-kubernetes/README.adoc b/cassandra-kubernetes/README.adoc index 1e8ca261d..9db2826ae 100644 --- a/cassandra-kubernetes/README.adoc +++ b/cassandra-kubernetes/README.adoc @@ -47,7 +47,7 @@ cassandra-1 1/1 Running 0 2h You can also verify the health of your cluster by running ---- -$ kubectl exec -it nodetool status +$ kubectl exec -- nodetool status Datacenter: DC1-K8Demo ====================== Status=Up/Down diff --git a/cassandra-kubernetes/pom.xml b/cassandra-kubernetes/pom.xml index d2f149b69..83b70f559 100644 --- a/cassandra-kubernetes/pom.xml +++ b/cassandra-kubernetes/pom.xml @@ -35,7 +35,7 @@ Database - 4.0.0 + 4.19.2 org.apache.camel.spring.Main @@ -74,8 +74,8 @@ - com.datastax.cassandra - cassandra-driver-core + org.apache.cassandra + java-driver-core ${cassandra.driver.version} diff --git a/cassandra-kubernetes/src/main/java/org/apache/camel/example/kubernetes/jkube/CqlPopulateBean.java b/cassandra-kubernetes/src/main/java/org/apache/camel/example/kubernetes/jkube/CqlPopulateBean.java index 2e5a7668d..92e3e25e6 100644 --- a/cassandra-kubernetes/src/main/java/org/apache/camel/example/kubernetes/jkube/CqlPopulateBean.java +++ b/cassandra-kubernetes/src/main/java/org/apache/camel/example/kubernetes/jkube/CqlPopulateBean.java @@ -16,8 +16,7 @@ */ package org.apache.camel.example.kubernetes.jkube; -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Session; +import com.datastax.oss.driver.api.core.CqlSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,8 +25,7 @@ public class CqlPopulateBean { private static final Logger log = LoggerFactory.getLogger(CqlPopulateBean.class); public void populate() { - try (Cluster cluster = Cluster.builder().addContactPoint("cassandra").build(); - Session session = cluster.connect()) { + try (CqlSession session = CqlSession.builder()/*.addContactEndPoint("cassandra")*/.build();) { session.execute("CREATE KEYSPACE IF NOT EXISTS test WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':1};"); session.execute("CREATE TABLE IF NOT EXISTS test.users ( id int primary key, name text );"); session.execute("INSERT INTO test.users (id,name) VALUES (1, 'oscerd') IF NOT EXISTS;");