0
votes

Question regarding SpringBoot Webflux with reactive Cassandra please.

In the previous non reactive world, we could configure ConsistencyLevel as follow:

CassandraConfiguration extends AbstractCassandraConfiguration

    @Override
    public QueryOptions getQueryOptions() {
        QueryOptions queryOptions = new QueryOptions();
        queryOptions.setConsistencyLevel(ConsistencyLevel.TWO);
        return queryOptions;
    }

However, with AbstractReactiveCassandraConfiguration, it seems things changed.

@RefreshScope
@Configuration
@EnableReactiveCassandraRepositories
public class BaseCassandraConfiguration extends AbstractReactiveCassandraConfiguration {

    @Override
    public QueryOptions getQueryOptions() {
        QueryOptions queryOptions = new QueryOptions();
        queryOptions.setConsistencyLevel(ConsistencyLevel.TWO);
        return queryOptions;
    }

  • There is an issue on the @Override, "Method does to override from super class"

  • And the implementation of QueryOptions seems to have changed.

What is the correct way to configure the consistency level in Spring Webflux 2.3.5 + reactive Cassandra please?

Thank you

1

1 Answers

1
votes

You can configure the consistency level on the auto configured Session instance by using the following property

spring.data.cassandra.consistencyLevel