Migrate Cluster and Session to CqlSession
ProprietaryIn driver 4 a single CqlSession replaces driver 3's Cluster and Session. Cluster.builder() becomes CqlSession.builder(); withPort is folded into each contact point, which becomes an InetSocketAddress, with the port where the if that sets it holds and 9042 otherwise; a secure connect bundle file becomes a path; socket, query, pooling, reconnection, retry, speculative execution, protocol and compression options become one programmatic DriverConfigLoader; a DC-aware load balancing policy becomes withLocalDatacenter, and without one DcInferringLoadBalancingPolicy keeps driver 3's behavior of taking the local datacenter from the contact points. cluster.connect() becomes the session itself, and cluster.connect(keyspace) moves the keyspace into the builder with withKeyspace. Options the driver 4 builder has no counterpart for are marked with a TODO comment.
io. moderne. cassandra. driver4. MigrateClusterToCqlSessionmod run . --recipe= io. moderne. cassandra. driver4. MigrateClusterToCqlSessionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.