in src/main/java/com/amazonaws/gdcreplication/util/DDBUtil.java [93:121]
public boolean trackDatabaseImportStatus(String sourceGlueCatalogId, String targetGlueCatalogId, String ddbTblName, String databaseName,
long importRunId, String exportBatchId, boolean isCreated) {
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", databaseName).withNumber("import_run_id", importRunId)
.withString("export_batch_id", exportBatchId).withString("target_glue_catalog_id", targetGlueCatalogId)
.withString("source_glue_catalog_id", sourceGlueCatalogId).withBoolean("is_created", isCreated);
// 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("Database item inserted to DynamoDB table. Database name: " + databaseName);
}
} catch(Exception e) {
e.printStackTrace();
System.out.println("Could not insert a Database import status to DynamoDB table: " + ddbTblName);
}
dynamoDB.shutdown();
return itemInserted;
}