In this video we are going to deploy and testing our order acknowledgment microservices.
So for that purpose please open the widget to the code and we are going to deploy these Node.js project
as a lambda function.
So if you right click and reveal in Explorer, you can go to the lecture folder and copy all files without
removing the commands.
I'm going to right click and send to zip file.
This will be per form zip archiving these index or JavaScript and Node.js files.
I'm going to give the name as an order EQ knowledge function.
Okay.
Now we will deploy these functions to Lambda.
In order to do that, please go to the management console and go to the function of the order acknowledgement.
So you can come here and click the upload and zip file.
So now click the upload button and go to the folder structure and find the order folder and select these
function zip file and click open and click this button.
So this will be deploy our function into the lambda function and we will test these functions with sending
requests to the API gateway.
Look, the uploading operation is almost done.
Yes, our uploading operation is done.
Now we can check our codes in the code window.
We can see that the code structure will be same as we zipped in the file and we have an indexed JS file.
And if you scroll down and check that, verify that there is no error in our code.
Okay, very good.
So now we are going to test this code with sending http post request or api gateway is you remember
that these order lambda microservice triggered from the API gateway and we can trigger the API gateway
by sending a HTTP post request.
When we send this request, this will be triggered or function and perform our business logic.
In order to do that, please open the postman.
As you remember that we have already sent the post request when we starting this section.
So now we have implement the function.
So that means we should provide the payload as we expected.
In order to do that, please open the our common text file and copy this expected payload.
If you go back to our postman and come to Buddy.
Rove and Jason.
So we will set the payload of the our HTTP post request and this is the are order API gateway save this
request and sent HTTP post request.
Click the send button.
So this will trigger our order lambda function.
And after that this will return back to synchronous response.
As you can see that the message comes from successfully finished order create operation.
So that means it is successfully create an item in dynamo DB and also successful publish to order topic
to order place JSON file.
Okay, let's verify one by one.
So for that purpose, I'm going to open the mail console.
And first of all, I would like to go to monitor and we've included logs.
So we are in here and this is the order acknowledgements and that means we will send the post request
and this invocation triggered the order acknowledgements and I'm checking these logs in here.
So if you come back and open the latest log stream, you can see that this is the incoming event JSON
object from the API gateway.
This is the post for the order.
And if you scroll down in the body section, you can see the our actual JSON format, which is the order
created order places JSON file.
After that, we have successful publish to SAS.
You can see the log and here you can see the details.
And after that we will successfully create our team item on Dynamo DB table.
So now we will follow one by one.
First of all, let me check the DB table item and if you go to Dynamo DB tables and order, you can
see the explore items.
We have one item created successfully, this idea generated from the UUID in our order lambda function
code.
And this is the values that we sent from the payload of the HTTP post request.
Okay, very good.
So that means we have verified these two steps and now let me verify from the published message site.
So in order to do that, I'm going to go to these Psns and asks.
Q If you open the order topic, since we don't see any monitoring section in here because it is file
and forget, but if you open the subscriptions, for example, these queues, if you open the SGS queue
and open the inventory queue and if you go to monitoring section, you can see that we have seen some
of the messages received and message send actions happen for the security code.
So in order to verify that, we should check our architecture.
If you go back to our architecture, we know that these message publish successful to SAS and the SAS
subscribed from these three queues and these queue items pulling from the downstream microservices.
So if you go to our notification microservice and you mentioned microservice, I would like to see the
invocation and see the invocation comes from the API gateway payload in here.
So let's go to the lambda functions and understand how it is triggered.
Form the notification microservices.
Open the notification microservices go to monitor and we include voice logs.
So if you open the latest log C three, you can see the incoming event object comes in here.
So basically this just comes from the order records, which is the notification queue.
And in the queue item we have message ID receive handle and the body information.
In the body information, if you look at deeply, you will understand that these queue item comes from
the SAS because type is a notification, you can see the message and other details.
So in the SAS message you can see the our actual JSON payload which we sent from the postman.
If you go back to postman, you can see that we send these username, item and status.
If you open the notification microservices, we can verify that in the body of the message we can see
the our actual JSON object that we send when we are requesting HTTP post requests to API gateway.
Okay.
Very good.
I'm going to copy this payload and I'm going to open the wish to do a code and I would like to paste
into here I have create a separate lecture folder and create a notification JSON file and in here I'm
saving this JSON file.
So here you can see the order acknowledgement event comes from the API gateway and here we can see the
sender body information as a payload and this will be goes to until you go to SNS publish topic and
as case will pull from the notification event as this format which is the records and in the records
we have body information.
In the body we have message and in the message we have actual payload.
You can see the actual payload under the message.
Now the same way I would like to check other downstream microservices.
If you come back to functions, for example, check for the shipment microservices.
If you come to monitoring and we've uncovered large logs, let's verify that we can see same in location
in here.
If you open the last location and copy it from here and I'm going to go back to our we used to do code
and I have create a naive file which is the.
Shipment.
You want that Jason file and paste in here.
So as you can see that the same execution comes in here, this shipment receive and pull message from
the queue, which is the shipment queue and queue.
Subscribe from the SNS and we can say that the information comes from the SNS topic and if you come
here you can see the actual message is comes as we expected in here.
Okay, very good.
So as you can see that we have verified the flow in here.
We basically sent the SNS topic from the lambda function, which is the order acknowledgements publish
message to SNS and SNS message consume from the case and case records pulling from the lambda function
which is the downstream microservices.
So that means now we are going to handle incoming message with pulling from the case item into the set
of microservices and it is come from order acknowledgement and pulling from the downstream microservices.
We will accommodate this message as a screw message in the notification eventually and shipment microservices
and interact with the other services.
For example, I would like to select the inventory.
Inventory will be pulled from the SCS item and accommodate these incoming events in the inventory and
we will save these item into Dynamo DB table, which we create inventory table.