1
00:00:00,240 --> 00:00:06,270
In this section, we are going to do hands on lap, which is the saga pattern for orchestrate distributed

2
00:00:06,270 --> 00:00:09,330
transactions using a step functions.

3
00:00:10,130 --> 00:00:12,680
So let's start with fundamentals of this section.

4
00:00:12,680 --> 00:00:18,440
Topic with remembering microservices and communications is enough that microservices are organized around

5
00:00:18,440 --> 00:00:22,310
business capabilities with a separate database per microservices.

6
00:00:22,400 --> 00:00:28,270
Microservices are loosely coupled and they use asynchronous messaging to communicate with each other.

7
00:00:28,280 --> 00:00:30,860
Microservices are independently deployable.

8
00:00:31,160 --> 00:00:36,200
So let's think microservices on ecommerce domain, you can see the image on the slide.

9
00:00:36,200 --> 00:00:42,050
Basically, this is the order fulfillment process and we will implement these order fulfillment process

10
00:00:42,050 --> 00:00:45,170
with orchestration using a list step functions.

11
00:00:45,200 --> 00:00:46,610
Let me explain the steps.

12
00:00:46,610 --> 00:00:53,480
One by one, the customer is placed an order using frontend channels and API gateway invoke to order

13
00:00:53,480 --> 00:00:58,070
microservices and the order fulfillment process is started.

14
00:00:58,640 --> 00:01:04,010
So order is going to check if the item is available in the inventory or not.

15
00:01:04,040 --> 00:01:10,220
If the inventory is available, it is basically the dock item in the inventory database and it calls

16
00:01:10,220 --> 00:01:11,810
the payment microservices.

17
00:01:11,900 --> 00:01:18,230
If the payment is successfully done with third party integration, it starts with the delivery microservices.

18
00:01:18,230 --> 00:01:22,010
And when the delivery is done, the order status will be completed.

19
00:01:22,310 --> 00:01:28,760
If one of these steps are not successful, it should be rolled back the steps and return back to the

20
00:01:28,760 --> 00:01:29,750
previous status.

21
00:01:29,750 --> 00:01:35,780
For example, we should return back to the inventory database table and we should return back to the

22
00:01:35,780 --> 00:01:39,050
payment microservices and order microservices and so on.

23
00:01:39,050 --> 00:01:41,900
And we will set the status as a fail status.

24
00:01:41,900 --> 00:01:46,070
So all these rollback statements should be handled by the orchestrator.

25
00:01:46,070 --> 00:01:52,280
So how we can set up these workflow in microservice architectures of course with using saga pattern.

26
00:01:52,280 --> 00:01:55,190
So now it is good to understand what is a pattern.
