In order to simplify our ability (for this lab) to identify activity for tenant order tables, we’re going to add a bit of logging detail to our order service to include this information. Go to the insertOrder() function in our OrderServiceDAL.java file. Let’s make the following changes to the the function. First, add the two new line above the call to putItem(). This will fetch the table name in a separate step. Then, add the next line, which will log the table name. Finally, since we have already fetched the table name, we can change Line XX to what is shown below, replacing the getTableName() call with the tableName we already fetched.
// add these two lines to fetch and log the table name
String tableName = tableName(event);
LoggingManager.log(event, "OrderServiceDAL::insertOrder TableName = " + tableName);
// change this line to reference the tableName fetched above
PutItemResponse response = ddb.putItem(request -> request.tableName(tableName).item(item));