1
00:00:00,210 --> 00:00:06,420
In this video we are going to deploy and testing our order acknowledgment microservices.

2
00:00:06,660 --> 00:00:13,350
So for that purpose please open the widget to the code and we are going to deploy these Node.js project

3
00:00:13,350 --> 00:00:14,880
as a lambda function.

4
00:00:14,880 --> 00:00:24,720
So if you right click and reveal in Explorer, you can go to the lecture folder and copy all files without

5
00:00:24,720 --> 00:00:26,220
removing the commands.

6
00:00:26,250 --> 00:00:31,350
I'm going to right click and send to zip file.

7
00:00:33,090 --> 00:00:40,080
This will be per form zip archiving these index or JavaScript and Node.js files.

8
00:00:40,110 --> 00:00:45,180
I'm going to give the name as an order EQ knowledge function.

9
00:00:45,270 --> 00:00:45,910
Okay.

10
00:00:45,930 --> 00:00:48,420
Now we will deploy these functions to Lambda.

11
00:00:48,420 --> 00:00:55,350
In order to do that, please go to the management console and go to the function of the order acknowledgement.

12
00:00:55,650 --> 00:00:59,460
So you can come here and click the upload and zip file.

13
00:01:00,190 --> 00:01:08,140
So now click the upload button and go to the folder structure and find the order folder and select these

14
00:01:08,140 --> 00:01:11,680
function zip file and click open and click this button.

15
00:01:11,680 --> 00:01:18,790
So this will be deploy our function into the lambda function and we will test these functions with sending

16
00:01:18,790 --> 00:01:21,550
requests to the API gateway.

17
00:01:22,390 --> 00:01:24,840
Look, the uploading operation is almost done.

18
00:01:24,850 --> 00:01:27,890
Yes, our uploading operation is done.

19
00:01:27,910 --> 00:01:30,520
Now we can check our codes in the code window.

20
00:01:30,550 --> 00:01:38,050
We can see that the code structure will be same as we zipped in the file and we have an indexed JS file.

21
00:01:38,080 --> 00:01:42,790
And if you scroll down and check that, verify that there is no error in our code.

22
00:01:42,840 --> 00:01:44,210
Okay, very good.

23
00:01:44,230 --> 00:01:50,590
So now we are going to test this code with sending http post request or api gateway is you remember

24
00:01:50,590 --> 00:01:57,160
that these order lambda microservice triggered from the API gateway and we can trigger the API gateway

25
00:01:57,170 --> 00:01:59,550
by sending a HTTP post request.

26
00:01:59,560 --> 00:02:05,020
When we send this request, this will be triggered or function and perform our business logic.

27
00:02:05,050 --> 00:02:07,690
In order to do that, please open the postman.

28
00:02:07,780 --> 00:02:13,480
As you remember that we have already sent the post request when we starting this section.

29
00:02:13,480 --> 00:02:15,100
So now we have implement the function.

30
00:02:15,100 --> 00:02:19,060
So that means we should provide the payload as we expected.

31
00:02:19,180 --> 00:02:26,060
In order to do that, please open the our common text file and copy this expected payload.

32
00:02:26,080 --> 00:02:31,150
If you go back to our postman and come to Buddy.

33
00:02:32,040 --> 00:02:34,260
Rove and Jason.

34
00:02:34,260 --> 00:02:42,060
So we will set the payload of the our HTTP post request and this is the are order API gateway save this

35
00:02:42,060 --> 00:02:45,150
request and sent HTTP post request.

36
00:02:45,180 --> 00:02:46,440
Click the send button.

37
00:02:46,830 --> 00:02:49,980
So this will trigger our order lambda function.

38
00:02:49,980 --> 00:02:53,070
And after that this will return back to synchronous response.

39
00:02:53,130 --> 00:02:57,810
As you can see that the message comes from successfully finished order create operation.

40
00:02:57,810 --> 00:03:04,110
So that means it is successfully create an item in dynamo DB and also successful publish to order topic

41
00:03:04,110 --> 00:03:06,000
to order place JSON file.

42
00:03:06,180 --> 00:03:08,640
Okay, let's verify one by one.

43
00:03:08,640 --> 00:03:13,620
So for that purpose, I'm going to open the mail console.

44
00:03:13,620 --> 00:03:17,940
And first of all, I would like to go to monitor and we've included logs.

45
00:03:18,000 --> 00:03:24,690
So we are in here and this is the order acknowledgements and that means we will send the post request

46
00:03:24,690 --> 00:03:29,520
and this invocation triggered the order acknowledgements and I'm checking these logs in here.

47
00:03:29,520 --> 00:03:35,040
So if you come back and open the latest log stream, you can see that this is the incoming event JSON

48
00:03:35,040 --> 00:03:36,800
object from the API gateway.

49
00:03:36,810 --> 00:03:38,640
This is the post for the order.

50
00:03:38,640 --> 00:03:44,310
And if you scroll down in the body section, you can see the our actual JSON format, which is the order

51
00:03:44,310 --> 00:03:46,410
created order places JSON file.

52
00:03:46,980 --> 00:03:49,910
After that, we have successful publish to SAS.

53
00:03:49,920 --> 00:03:52,890
You can see the log and here you can see the details.

54
00:03:52,890 --> 00:03:57,030
And after that we will successfully create our team item on Dynamo DB table.

55
00:03:57,030 --> 00:03:59,070
So now we will follow one by one.

56
00:03:59,070 --> 00:04:05,880
First of all, let me check the DB table item and if you go to Dynamo DB tables and order, you can

57
00:04:05,880 --> 00:04:07,440
see the explore items.

58
00:04:07,440 --> 00:04:13,650
We have one item created successfully, this idea generated from the UUID in our order lambda function

59
00:04:13,650 --> 00:04:14,040
code.

60
00:04:14,040 --> 00:04:19,140
And this is the values that we sent from the payload of the HTTP post request.

61
00:04:19,340 --> 00:04:20,310
Okay, very good.

62
00:04:20,310 --> 00:04:26,280
So that means we have verified these two steps and now let me verify from the published message site.

63
00:04:26,280 --> 00:04:31,520
So in order to do that, I'm going to go to these Psns and asks.

64
00:04:31,540 --> 00:04:37,680
Q If you open the order topic, since we don't see any monitoring section in here because it is file

65
00:04:37,680 --> 00:04:43,920
and forget, but if you open the subscriptions, for example, these queues, if you open the SGS queue

66
00:04:43,920 --> 00:04:50,250
and open the inventory queue and if you go to monitoring section, you can see that we have seen some

67
00:04:50,250 --> 00:04:55,200
of the messages received and message send actions happen for the security code.

68
00:04:55,200 --> 00:04:58,290
So in order to verify that, we should check our architecture.

69
00:04:58,290 --> 00:05:04,980
If you go back to our architecture, we know that these message publish successful to SAS and the SAS

70
00:05:04,980 --> 00:05:11,430
subscribed from these three queues and these queue items pulling from the downstream microservices.

71
00:05:11,430 --> 00:05:16,080
So if you go to our notification microservice and you mentioned microservice, I would like to see the

72
00:05:16,080 --> 00:05:21,270
invocation and see the invocation comes from the API gateway payload in here.

73
00:05:21,270 --> 00:05:26,130
So let's go to the lambda functions and understand how it is triggered.

74
00:05:26,130 --> 00:05:28,320
Form the notification microservices.

75
00:05:28,380 --> 00:05:32,940
Open the notification microservices go to monitor and we include voice logs.

76
00:05:35,580 --> 00:05:41,930
So if you open the latest log C three, you can see the incoming event object comes in here.

77
00:05:41,940 --> 00:05:47,730
So basically this just comes from the order records, which is the notification queue.

78
00:05:47,730 --> 00:05:52,290
And in the queue item we have message ID receive handle and the body information.

79
00:05:52,290 --> 00:05:59,070
In the body information, if you look at deeply, you will understand that these queue item comes from

80
00:05:59,070 --> 00:06:04,170
the SAS because type is a notification, you can see the message and other details.

81
00:06:04,170 --> 00:06:11,220
So in the SAS message you can see the our actual JSON payload which we sent from the postman.

82
00:06:11,220 --> 00:06:15,660
If you go back to postman, you can see that we send these username, item and status.

83
00:06:15,660 --> 00:06:21,870
If you open the notification microservices, we can verify that in the body of the message we can see

84
00:06:21,870 --> 00:06:27,960
the our actual JSON object that we send when we are requesting HTTP post requests to API gateway.

85
00:06:28,170 --> 00:06:28,590
Okay.

86
00:06:28,620 --> 00:06:29,100
Very good.

87
00:06:29,100 --> 00:06:36,270
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

88
00:06:36,270 --> 00:06:42,780
into here I have create a separate lecture folder and create a notification JSON file and in here I'm

89
00:06:42,780 --> 00:06:44,400
saving this JSON file.

90
00:06:44,400 --> 00:06:51,720
So here you can see the order acknowledgement event comes from the API gateway and here we can see the

91
00:06:51,720 --> 00:06:58,170
sender body information as a payload and this will be goes to until you go to SNS publish topic and

92
00:06:58,200 --> 00:07:04,530
as case will pull from the notification event as this format which is the records and in the records

93
00:07:04,530 --> 00:07:05,700
we have body information.

94
00:07:05,700 --> 00:07:10,170
In the body we have message and in the message we have actual payload.

95
00:07:10,200 --> 00:07:12,480
You can see the actual payload under the message.

96
00:07:12,480 --> 00:07:15,990
Now the same way I would like to check other downstream microservices.

97
00:07:15,990 --> 00:07:21,120
If you come back to functions, for example, check for the shipment microservices.

98
00:07:21,120 --> 00:07:28,890
If you come to monitoring and we've uncovered large logs, let's verify that we can see same in location

99
00:07:28,890 --> 00:07:29,280
in here.

100
00:07:29,280 --> 00:07:37,110
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

101
00:07:37,110 --> 00:07:39,930
and I have create a naive file which is the.

102
00:07:41,030 --> 00:07:41,810
Shipment.

103
00:07:44,190 --> 00:07:47,300
You want that Jason file and paste in here.

104
00:07:47,310 --> 00:07:53,730
So as you can see that the same execution comes in here, this shipment receive and pull message from

105
00:07:53,730 --> 00:07:56,440
the queue, which is the shipment queue and queue.

106
00:07:56,460 --> 00:08:03,330
Subscribe from the SNS and we can say that the information comes from the SNS topic and if you come

107
00:08:03,330 --> 00:08:08,220
here you can see the actual message is comes as we expected in here.

108
00:08:08,250 --> 00:08:09,240
Okay, very good.

109
00:08:09,240 --> 00:08:13,260
So as you can see that we have verified the flow in here.

110
00:08:13,260 --> 00:08:19,620
We basically sent the SNS topic from the lambda function, which is the order acknowledgements publish

111
00:08:19,620 --> 00:08:26,190
message to SNS and SNS message consume from the case and case records pulling from the lambda function

112
00:08:26,190 --> 00:08:27,900
which is the downstream microservices.

113
00:08:27,900 --> 00:08:35,030
So that means now we are going to handle incoming message with pulling from the case item into the set

114
00:08:35,040 --> 00:08:42,240
of microservices and it is come from order acknowledgement and pulling from the downstream microservices.

115
00:08:42,240 --> 00:08:49,650
We will accommodate this message as a screw message in the notification eventually and shipment microservices

116
00:08:49,650 --> 00:08:51,960
and interact with the other services.

117
00:08:51,960 --> 00:08:54,390
For example, I would like to select the inventory.

118
00:08:54,390 --> 00:09:00,570
Inventory will be pulled from the SCS item and accommodate these incoming events in the inventory and

119
00:09:00,570 --> 00:09:05,040
we will save these item into Dynamo DB table, which we create inventory table.
