in src/main/java/com/amazonaws/gdcreplication/lambda/DLQImportDatabaseOrTable.java [126:166]
public void processsRecord(Context context, AWSGlue glue, AmazonSQS sqs, String sqsQueueURL,
String targetGlueCatalogId, String ddbTblNameForDBStatusTracking, String ddbTblNameForTableStatusTracking,
String message, boolean skipTableArchive, String exportBatchId, String sourceGlueCatalogId,
boolean isTable) {
boolean isDatabaseType = false;
boolean isTableType = false;
Database db = null;
TableWithPartitions table = null;
Gson gson = new Gson();
if (isTable) {
context.getLogger().log("The input message is of type Glue Table.");
try {
table = gson.fromJson(message, TableWithPartitions.class);
isTableType = true;
} catch (JsonSyntaxException e) {
System.out.println("Cannot parse SNS message to Glue Table Type.");
e.printStackTrace();
}
} else {
context.getLogger().log("The input message is of type Glue Database.");
try {
db = gson.fromJson(message, Database.class);
isDatabaseType = true;
} catch (JsonSyntaxException e) {
System.out.println("Cannot parse SNS message to Glue Database Type.");
e.printStackTrace();
}
}
// Execute the business logic based on the message type
GDCUtil gdcUtil = new GDCUtil();
if (isDatabaseType) {
gdcUtil.processDatabseSchema(glue, sqs, targetGlueCatalogId, db, message, sqsQueueURL, sourceGlueCatalogId,
exportBatchId, ddbTblNameForDBStatusTracking);
} else if (isTableType) {
gdcUtil.processTableSchema(glue, sqs, targetGlueCatalogId, sourceGlueCatalogId, table, message,
ddbTblNameForTableStatusTracking, sqsQueueURL, exportBatchId, skipTableArchive);
}
}