@ Override public void createResource ( ) throws Exception { cluster = builder . getCluster ( ) ; session = cluster . connect ( ) ; session . execute ( String . format ( "CREATE KEYSPACE IF NOT EXISTS %s with replication={'class':'SimpleStrategy', 'replication_factor':1};" , keySpace ) ) ; session . execute ( String . format ( "CREATE TABLE IF NOT EXISTS %s.%s (sink_id text, sub_id int, checkpoint_id bigint, PRIMARY KEY (sink_id, sub_id));" , keySpace , table ) ) ; try { session . close ( ) ; } catch ( Exception e ) { LOG . error ( "Error while closing session." , e ) ; } try { cluster . close ( ) ; } catch ( Exception e ) { LOG . error ( "Error while closing cluster." , e ) ; } }
Generates the necessary tables to store information .