List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBStreamsClient AmazonDynamoDBStreamsClient
AmazonDynamoDBStreamsClient(AwsSyncClientParams clientParams)
From source file:tr.com.serkanozal.samba.cache.impl.SambaGlobalCache.java
License:Open Source License
public SambaGlobalCache(CacheChangeListener cacheChangeListener) { try {/* w w w . j ava 2 s. c om*/ Properties sambaProps = getProperties("samba.properties"); String tableName = sambaProps.getProperty("cache.global.tableName"); if (tableName != null) { DYNAMO_DB_TABLE_NAME = tableName; } else { DYNAMO_DB_TABLE_NAME = "___SambaGlobalCache___"; } String readCapacityPerSecond = sambaProps.getProperty("cache.global.readCapacityPerSecond"); if (readCapacityPerSecond != null) { DYNAMO_DB_TABLE_READ_CAPACITY_PER_SECOND = Integer.parseInt(readCapacityPerSecond); } else { DYNAMO_DB_TABLE_READ_CAPACITY_PER_SECOND = 1000; } String writeCapacityPerSecond = sambaProps.getProperty("cache.global.writeCapacityPerSecond"); if (writeCapacityPerSecond != null) { DYNAMO_DB_TABLE_WRITE_CAPACITY_PER_SECOND = Integer.parseInt(writeCapacityPerSecond); } else { DYNAMO_DB_TABLE_WRITE_CAPACITY_PER_SECOND = 100; } ///////////////////////////////////////////////////////////////// Properties awsProps = getProperties("aws-credentials.properties"); AWSCredentials awsCredentials = new BasicAWSCredentials(awsProps.getProperty("aws.accessKey"), awsProps.getProperty("aws.secretKey")); DYNAMO_DB = new AmazonDynamoDBClient(awsCredentials); DYNAMO_DB_STREAMS = new AmazonDynamoDBStreamsClient(awsCredentials); DYNAMO_DB_TABLE = ensureTableAvailable(); } catch (IOException e) { throw new RuntimeException(e); } if (cacheChangeListener != null) { registerCacheChangeListener(cacheChangeListener); } }