Builder Configuration

Concept

CasquatchDao provides a CasquatchDaoBuilder via a static CasquatchDao.builder() method. The builder is designed to include all configuration properties converted from . format to method names as follows:

casquatch.basic.session.keyspace

becomes

builder.withBasicSessionKeyspace(String keyspace);

Examples

Basic Driver

CasquatchDao casquatchDao = 
    CasquatchDao.builder()
        .withBasicContactPoints("127.0.0.1:9042")
        .withBasicLoadBalancingPolicyLocalDatacenter("DC1")
        .withBasicSessionKeyspace("demo")
        .build();

Basic Driver with Authentication

CasquatchDao casquatchDao = 
    CasquatchDao.builder()
        .withBasicContactPoints("127.0.0.1:9042")
        .withBasicLoadBalancingPolicyLocalDatacenter("DC1")
        .withBasicSessionKeyspace("demo")
        .withAdvancedAuthProviderUsername("cassandra")
        .withAdvancedAuthProviderPassword("cassandra")
        .build();

Advanced Example

CasquatchDao casquatchDao = 
    CasquatchDao.builder()
        .withBasicContactPoints("127.0.0.1:9042")
        .withBasicLoadBalancingPolicyLocalDatacenter("DC1")
        .withBasicSessionKeyspace("demo")
        .withAdvancedAuthProviderUsername("cassandra")
        .withAdvancedAuthProviderPassword("cassandra")
        .startProfile("remote")
        .withBasicLoadBalancingPolicyLocalDatacenter("DC2")
        .endProfile()
        .withFailoverPolicyProfile("remote")
        .withBasicRequestTimeout("2 seconds")
        .build();
Copyright 2018 T-Mobile US, Inc.
Code For Demonstration Purposes Only