in src/main/java/com/amazonaws/gdcreplication/util/DDBUtil.java [189:220]
public boolean trackDatabaseExportStatus(String ddbTblName, String glueDBName, String glueDBSchema, String snsMsgId,
String glueCatalogId, long exportRunId, String exportBatchId, boolean isExported) {
boolean itemInserted = false;
ClientConfiguration cc = new ClientConfiguration();
cc.setMaxErrorRetry(10);
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().withClientConfiguration(cc).build();
DynamoDB dynamoDB = new DynamoDB(client);
com.amazonaws.services.dynamodbv2.document.Table table = dynamoDB.getTable(ddbTblName);
Item item = new Item().withPrimaryKey("db_id", glueDBName)
.withNumber("export_run_id", exportRunId)
.withString("export_batch_id", exportBatchId)
.withString("source_glue_catalog_id", glueCatalogId)
.withString("database_schema", glueDBSchema)
.withString("sns_msg_id", snsMsgId)
.withBoolean("is_exported", isExported);
// Write the item to the table
try {
PutItemOutcome outcome = table.putItem(item);
int statusCode = outcome.getPutItemResult().getSdkHttpMetadata().getHttpStatusCode();
if (statusCode == 200) {
itemInserted = true;
System.out.println("Status inserted to DynamoDB table for Glue Database: " + glueDBName);
}
} catch(Exception e) {
e.printStackTrace();
System.out.println("Could not insert a Database export status to DynamoDB table: " + ddbTblName);
}
dynamoDB.shutdown();
return itemInserted;
}