Hi All,

We are using achilles in our code. We are setting Consistency level as
below, but is not being set.Does anyone else have faced this issue.We have
three nodes in our cluster.

        PoolingOptions poolingOptions = new PoolingOptions();
        poolingOptions.setCoreConnectionsPerHost(HostDistance.REMOTE,
Integer.parseInt(env.getProperty("cassandra.core.connections.host")));
        poolingOptions.setMaxConnectionsPerHost(HostDistance.REMOTE,
Integer.parseInt(env.getProperty("cassandra.max.connections.host")));
        poolingOptions.setMaxRequestsPerConnection(HostDistance.REMOTE,
Integer.parseInt(env.getProperty("cassandra.max.requests.connections")));

        Cluster.Builder
builder=Cluster.builder().addContactPoints(env.getProperty("cassandra.host")).withPoolingOptions(poolingOptions).withPort(

Integer.parseInt(env.getProperty("cassandra.cql.port"))).withClusterName(CLUSTER_NAME);
        if(env.getProperty("cassandra.cql.user") != null){
            builder.withCredentials(env.getProperty("cassandra.cql.user"),
env.getProperty("cassandra.cql.password"));
        }
        Cluster cluster = builder.build();

        QueryLogger queryLogger =
QueryLogger.builder().withConstantThreshold(300).withMaxQueryStringLength(1000).build();
        cluster.register(queryLogger);
        String clRead = env.getProperty("cassandra.consistencylevel.read");
        String clWrite =
env.getProperty("cassandra.consistencylevel.write");
        LOG.info("Starting cassandra cluster for host {} and port {} ",
env.getProperty("cassandra.host"), env.getProperty("cassandra.cql.port"));
        LOG.info(" clRead {} and clWrite {}",  clRead, clWrite);
        final ManagerFactory factory =
ManagerFactoryBuilder.builder(cluster).withDefaultWriteConsistency(
                clWrite == null ? ConsistencyLevel.EACH_QUORUM :
ConsistencyLevel.valueOf(clWrite)).withDefaultReadConsistency(
                clRead == null ? ConsistencyLevel.ONE :
ConsistencyLevel.valueOf(clRead)).build();
        return factory;

-- 
Thanks & Regards

Raman Gugnani
*Senior Software Engineer | CaMS*
M: +91 8588892293 | T: 0124-6600000 | EXT: 14255
ASF Centre A | 2nd Floor | CA-2130 | Udyog Vihar Phase IV |
Gurgaon | Haryana | India

*Disclaimer:* This communication is for the sole use of the addressee and
is confidential and privileged information. If you are not the intended
recipient of this communication, you are prohibited from disclosing it and
are required to delete it forthwith. Please note that the contents of this
communication do not necessarily represent the views of Jasper Infotech
Private Limited ("Company"). E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The Company,
therefore, does not accept liability for any loss caused due to this
communication. *Jasper Infotech Private Limited, Registered Office: 1st
Floor, Plot 238, Okhla Industrial Estate, New Delhi - 110020 INDIA CIN:
U72300DL2007PTC168097*

Reply via email to