use of com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer in project aws-doc-sdk-examples by awsdocs.
the class DynamoDBLocalFixture method main.
public static void main(String[] args) throws Exception {
AmazonDynamoDB dynamodb = null;
try {
// Create an in-memory and in-process instance of DynamoDB Local
// that skips HTTP
dynamodb = DynamoDBEmbedded.create();
// use the DynamoDB API with DynamoDBEmbedded
listTables(dynamodb.listTables(), "DynamoDB Embedded");
} finally {
// Shutdown the thread pools in DynamoDB Local / Embedded
if (dynamodb != null) {
dynamodb.shutdown();
}
}
// Create an in-memory and in-process instance of DynamoDB Local that
// runs over HTTP
final String[] localArgs = { "-inMemory" };
DynamoDBProxyServer server = null;
try {
server = ServerRunner.createServerFromCommandLineArgs(localArgs);
server.start();
dynamodb = new AmazonDynamoDBClient();
dynamodb.setEndpoint("http://localhost:8000");
// use the DynamoDB API over HTTP
listTables(dynamodb.listTables(), "DynamoDB Local over HTTP");
} finally {
// Stop the DynamoDB Local endpoint
if (server != null) {
server.stop();
}
}
}
Aggregations