1
00:00:00,210 --> 00:00:04,710
In this video we are going to deploy and test basket microservices.

2
00:00:04,740 --> 00:00:11,280
We will test from the scratch, which is the HTTP post request with the payload of the API gateway.

3
00:00:11,280 --> 00:00:17,070
And this will be invoke our basket, lambda microservices basket and the microservice will be published.

4
00:00:17,130 --> 00:00:20,160
Check out event to the Amazon event which is custom event pass.

5
00:00:20,160 --> 00:00:28,050
And this will be run the event pattern and after that match the event and target the event to the Amazon

6
00:00:28,230 --> 00:00:30,210
case and notification microservices.

7
00:00:30,240 --> 00:00:36,300
Amazon is pulling from the ordering microservices and we will check the invocations ordering and notification

8
00:00:36,300 --> 00:00:39,510
microservices and see the logs from the cloud watch logs.

9
00:00:39,540 --> 00:00:40,920
Let's get started.

10
00:00:41,010 --> 00:00:46,680
Please open the pseudocode and let's start with the right click and reveal the next word.

11
00:00:46,680 --> 00:00:52,700
Select all and remove commands right click and send to compress it.

12
00:00:53,730 --> 00:00:57,540
And I'm going to give the name a zip file as a basket RMS.

13
00:00:59,550 --> 00:01:05,190
And this will be our deployment package that we are going to deploy to our Islam environment.

14
00:01:05,220 --> 00:01:11,370
Please go to the slum, the environment and open the basket microservices and in here please select

15
00:01:11,370 --> 00:01:14,700
the upload from zip file and click the upload button.

16
00:01:14,700 --> 00:01:23,550
Select the correct PEC, which is the section 43 and lecture 346 and select the basket MSG, Zip file

17
00:01:23,790 --> 00:01:24,990
and click the save button.

18
00:01:24,990 --> 00:01:29,760
This will be deploy our Node.js application to the Lambda Function of MMS.

19
00:01:30,450 --> 00:01:31,830
Let's get microservices.

20
00:01:31,920 --> 00:01:34,740
So see that we have successfully deployed.

21
00:01:34,740 --> 00:01:39,930
If you scroll down, we should review the code into the code window if there is an exception or not.

22
00:01:39,930 --> 00:01:41,880
See that we don't have any exceptions.

23
00:01:41,880 --> 00:01:43,530
So we are ready for the test.

24
00:01:43,530 --> 00:01:50,580
Now, in order to test this whole architecture, I'm going to send request to the post API Gateway of

25
00:01:50,580 --> 00:01:52,590
the Basket API gateway.

26
00:01:52,590 --> 00:01:57,750
If you open the API gateway as you remember that we have create basket API and you can see the stage

27
00:01:57,750 --> 00:02:00,250
and deploy the URL for the basket inaugural.

28
00:02:00,330 --> 00:02:03,630
Copy this URL and go to the postman.

29
00:02:03,630 --> 00:02:11,220
So I'm going to send a post request to this URL and with passing body information, role and JSON object.

30
00:02:11,220 --> 00:02:16,410
And in the JSON object, if you open the videos to the code and go to commands, as you remember that

31
00:02:16,410 --> 00:02:22,470
these are the expected payloads that we are going to send to a CDB six copy this payload and paste in

32
00:02:22,470 --> 00:02:22,980
here.

33
00:02:23,010 --> 00:02:31,230
So if you check the center HTTP post request, this will go to basket microservices and return back

34
00:02:31,230 --> 00:02:32,190
to synchronous response.

35
00:02:32,190 --> 00:02:37,470
You can see that we have got successful response from the basket microservice synchronously.

36
00:02:37,470 --> 00:02:44,820
So if we scroll down you can see the entry is also and we have a one event idea that triggered and published

37
00:02:44,820 --> 00:02:50,310
from the basket microservices to the Amazon event page and we can see the entries and event ID in here.

38
00:02:50,340 --> 00:02:51,060
Very good.

39
00:02:51,060 --> 00:02:57,810
So if you go back to our architecture, we basically sent post to basket API API Gateway and this will

40
00:02:57,810 --> 00:03:03,510
direct to the basket microservices and invoke the lambda function and this lambda function, publish

41
00:03:03,510 --> 00:03:09,240
checkout event, Amazon event page and response back to us our synchronous response and we will check

42
00:03:09,240 --> 00:03:13,860
now Amazon event page and this will be targeted to case and notification microservices.

43
00:03:13,860 --> 00:03:16,740
Let's check all cloud folks one by one.

44
00:03:16,740 --> 00:03:18,780
I will start with the basket microservices.

45
00:03:18,780 --> 00:03:24,650
If you open the lambda functions in the basket microservices, go to monitoring and weaving cloud watch

46
00:03:24,690 --> 00:03:30,570
logs so you can see how API gets triggered to our basket microservices here.

47
00:03:30,570 --> 00:03:35,430
You can see that this is the invocation comes from the API gateway.

48
00:03:35,460 --> 00:03:41,340
There is a resource PID and if you scroll down you can see the body information, you can copy this

49
00:03:41,340 --> 00:03:44,700
JSON object and go to the our command section.

50
00:03:44,700 --> 00:03:48,750
So basically we will create a new lecture folder which is the.

51
00:03:49,860 --> 00:03:50,790
Lecture.

52
00:03:53,070 --> 00:03:56,640
And I'm going to add a Neve file, which is the basket.

53
00:03:57,570 --> 00:03:58,170
You want.

54
00:03:58,900 --> 00:04:04,770
But Jason, I would like to copy paste all the Jason's from the old microservices here you can see the

55
00:04:04,770 --> 00:04:06,270
basket event Jason file.

56
00:04:06,270 --> 00:04:12,060
So now please go back to our lambda functions and follow the same steps if you come to functions.

57
00:04:12,060 --> 00:04:17,670
So I'm going to continue to notification microservices if you check the notifications, monitoring and

58
00:04:17,670 --> 00:04:21,150
viewing logs, see that notification event.

59
00:04:21,150 --> 00:04:23,220
Jason How to trigger from the location.

60
00:04:23,220 --> 00:04:29,760
If you open the latest log stream, you can see that we have got successfully triggered from the our

61
00:04:29,790 --> 00:04:33,360
Amazon event page to lambda function of notification microservices.

62
00:04:33,360 --> 00:04:39,420
Here you can see the event we have the trade app checkout basket and source is here and you can see

63
00:04:39,420 --> 00:04:42,540
the details in here, icon and price and so on.

64
00:04:42,540 --> 00:04:48,840
So if you copy this file and also I will save this file into our test lecture.

65
00:04:49,460 --> 00:04:53,000
So here you can find the notification event, that JSON file.

66
00:04:53,030 --> 00:04:56,540
This is the incoming event from the Amazon event.

67
00:04:57,080 --> 00:04:57,570
Okay.

68
00:04:57,590 --> 00:05:00,890
Now I'm going to go to ordering microservices.

69
00:05:00,890 --> 00:05:05,900
If you open the functions and go to order microservices, these will be pulled from the case.

70
00:05:05,900 --> 00:05:12,320
For that purpose we can see different incoming event to order microservices, so go to latest log stream

71
00:05:12,320 --> 00:05:16,740
and see invocation and here you can see the incoming event JSON from the case.

72
00:05:16,760 --> 00:05:20,700
If you go here and click to order event JSON and paste in here.

73
00:05:20,720 --> 00:05:27,050
So as you can see that this time we saw the records array because order pull events from the case and

74
00:05:27,050 --> 00:05:28,460
the record start.

75
00:05:28,460 --> 00:05:34,490
But the information we can see actual event which comes from the Amazon event page, you can see the

76
00:05:34,490 --> 00:05:36,680
detail type check out source in here.

77
00:05:36,710 --> 00:05:43,400
And also our actual payload is including the detail of this payload and we should get the detail and

78
00:05:43,400 --> 00:05:49,010
after that we should pass the JSON and reach the our actual JSON payload, which is coming from the

79
00:05:49,010 --> 00:05:50,240
Amazon API gateway.

80
00:05:50,540 --> 00:05:51,110
Okay.

81
00:05:51,110 --> 00:05:51,760
Very good.

82
00:05:51,770 --> 00:05:58,640
So if we go back to the management console and go to the Amazon event page, we can review the our rule

83
00:05:58,640 --> 00:06:01,040
and how rule is work.

84
00:06:01,070 --> 00:06:04,900
First of all, we should select our customers, which is a checkout basket event pass.

85
00:06:04,910 --> 00:06:12,230
If you open the checkout basket rule or event is comes this rule and this rule is run this event pattern

86
00:06:12,230 --> 00:06:18,590
and this payload is matched to our event pattern because the tail type and source equal and after that

87
00:06:18,590 --> 00:06:24,740
sent to our event, publish this event to the target systems which are the order queue and notification

88
00:06:24,740 --> 00:06:25,700
microservices.

89
00:06:25,700 --> 00:06:30,070
So as you can see that we basically complete end to end architecture.

90
00:06:30,080 --> 00:06:36,320
So now we are going to handle this message coming from the basket microservices to do and accommodate

91
00:06:36,320 --> 00:06:41,000
these message into order microservices and interact with the dynamic DB table.

92
00:06:41,000 --> 00:06:45,920
So in the next video we will develop the order microservices with the incoming event from the Amazon

93
00:06:45,960 --> 00:06:48,000
SDKs and interact with the Dynamo DB.
