Git Product home page Git Product logo

Comments (3)

mp911de avatar mp911de commented on April 28, 2024 1

Sorry, I misunderstood your question and now that you've posted some code, it made it clear what you're asking for. So SessionBuilderConfigurer available on AbstractSessionConfiguration and its subclasses is the way to go.

It makes sense to document SessionBuilderConfigurer in our reference documentation to make it easier to find what you were asking for.

from spring-data-cassandra.

mp911de avatar mp911de commented on April 28, 2024

AbstractReactiveCassandraConfiguration creates a CQL session when configuring beans.

If you want to build a configuration that is robust against Cassandra absence, then you cannot:

  • Use schema support
  • A configuration built on Abstract…CassandraConfiguration

You also need to provide a SessionFactory implementation to defer session creation to a later time.

from spring-data-cassandra.

miladamery avatar miladamery commented on April 28, 2024

Thanks but I want to ask if this works. I looked at how spring boot configures CqlSession for Astra Db. There is CqlSessionCustomizer that does the job. Spring boot setups CqlSession via a CqlSessionBuilder setting contact points, setting keyspace etc but at the end calling the customizer.
According to this stack question and examples in datastax repos something like below does the job:

@Bean
public CqlSessionBuilderCustomizer sessionBuilderCustomizer(DataStaxAstraProperties astraProperties) {
    Path bundle = astraProperties.getSecureConnectBundle().toPath();
    return builder -> builder.withCloudSecureConnectBundle(bundle);
}

Almost same identical code exists in normal spring data cassandra. in AbstractSessionConfiguration there is method SessionBuilderConfigurer. What happens here is almost the same thing that happens in spring boot. So I wonder if the following does the job of connecting to astra Db with connect bundle file:

public class ReactiveCassandraConfig extends AbstractReactiveCassandraConfiguration {

    private String keySpace;

    private String connectBundlePath;
    @Override
    protected String getKeyspaceName() {
        return keySpace;
    }

    @Override
    protected SessionBuilderConfigurer getSessionBuilderConfigurer() {
        return sessionBuilder -> sessionBuilder
                .withCloudSecureConnectBundle(Path.of(connectBundlePath));
    }
}

from spring-data-cassandra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.