Let’s start by finding the code of our Order service. Open the Cloud9 IDE in the AWS console and select the “Serverless SaaS Workshop IDE“. With the IDE, we can now examine the code that currently exists for our Order service. To get there, open the “Lab 3“ folder in the left-hand pane of the page. Under the “order-service/src/main/java“ you will find the various Java files that makeup our Order service. Double-click on the “OrderService.java“ file to view its contents and locate the “insertOrder“ function within the Java class (on line XX). The function will appear as follows:
public APIGatewayProxyResponseEvent insertOrder(Map<String, Object> event, Context context) {
logRequestEvent(event);
LoggingManager.log(event, "OrderService::insertOrder");
APIGatewayProxyResponseEvent response = null;
// insert code to write the order here
return response;
In looking at this function more closely, you’ll discover that the function isn’t actually finished. It’s essentially recording a log and returning null. This is why our orders aren’t being written—the code was never finished. In fact, there’s a comment in the coding showing us where the code needs to be inserted.