1
00:00:00,560 --> 00:00:05,840
In this video, we are going to talk about Amazon, create visibility, time out.

2
00:00:06,410 --> 00:00:11,580
This is the one of the important features that we should understand when we are working out on is.

3
00:00:12,190 --> 00:00:18,760
So basically when a consumer receive a process, a message from the queue, the message is remains in

4
00:00:18,760 --> 00:00:19,330
the queue.

5
00:00:20,060 --> 00:00:27,440
So Amazon case doesn't automatically delete the message because Amazon is a distributed system and there

6
00:00:27,440 --> 00:00:31,170
is no guarantee that the consumer actually receives the message.

7
00:00:31,190 --> 00:00:36,560
For example, due to a connective tissue or due to an issue in the consumer application.

8
00:00:37,810 --> 00:00:44,470
That's why the consumer must delete the message from the queue after receiving and processing it immediately

9
00:00:44,470 --> 00:00:47,320
after a message is received, it remains in the queue.

10
00:00:48,510 --> 00:00:55,440
So in order to prevent other consumers from the processing the message again, Amazon sets a visibility

11
00:00:55,440 --> 00:01:02,790
timeout, which is the period of time during which Amazon prevents other consumers from receiving and

12
00:01:02,790 --> 00:01:04,050
processing the message.

13
00:01:04,710 --> 00:01:11,070
The default visible to timeout for a message is 30 seconds and the minimum is 0 seconds.

14
00:01:11,340 --> 00:01:13,890
The maximum is 12 hours.

15
00:01:14,490 --> 00:01:20,100
We can also configuring the visibility timeout for a queue using the measurement console.

16
00:01:20,130 --> 00:01:26,060
Also, we will configure with infrastructure as code using the our SDK application.

17
00:01:26,220 --> 00:01:32,070
We will perform the set, the visible timeout both configured from the measurement console.

18
00:01:32,070 --> 00:01:37,570
And after that we will configure from the HDC application when we are creating the A queue.

19
00:01:37,980 --> 00:01:45,000
And if you look at the image on the slide, we can understand how Amazon visibility timeout is working.

20
00:01:45,060 --> 00:01:51,930
You can see in here at this point, one received message request comes from the consumer.

21
00:01:52,080 --> 00:01:57,210
You can see in here, for example, we have a consumer one and consumer one.

22
00:01:57,210 --> 00:02:04,170
Consume the message A in this point and during the time of the visible timeout message, A cannot be

23
00:02:04,170 --> 00:02:09,720
returned any other consumers in order to avoid reprocess again and again.

24
00:02:09,720 --> 00:02:14,620
So we expect that these consumer one will be processed.

25
00:02:14,620 --> 00:02:20,370
The message A And after finishing the operation where consumer one should be, delete the message from

26
00:02:20,370 --> 00:02:20,910
the queue.

27
00:02:21,920 --> 00:02:25,940
The Amazon case doesn't delete any message in the queue.

28
00:02:25,970 --> 00:02:32,960
Its expected message will be delete from the consumers then consume operation finished so during the

29
00:02:32,960 --> 00:02:37,240
visible time and no consumers can consume the message again.

30
00:02:37,250 --> 00:02:45,230
Message A In our examples because Amazon doesn't delete any message and Amazon is a distributed system

31
00:02:45,230 --> 00:02:47,900
and not interested in deleting any message.

32
00:02:47,900 --> 00:02:54,270
Expect the message should be delayed after processing from the consumers and in the visible timeout.

33
00:02:54,290 --> 00:02:58,400
The expected behavior is after consuming from the consumer.

34
00:02:58,400 --> 00:02:59,210
One the message.

35
00:02:59,210 --> 00:03:03,400
A message will be deleted from the consumer one in the queue.

36
00:03:03,410 --> 00:03:10,880
But if the consumer one is down and cannot process this message after the visible timeout, these messages

37
00:03:10,910 --> 00:03:12,760
will be reactivated in the queue.

38
00:03:12,770 --> 00:03:20,550
And once when any consumer request again this message A this will be returned from the Amazon space,

39
00:03:20,570 --> 00:03:21,300
for example.

40
00:03:21,320 --> 00:03:25,150
At this point, Consumer two can be consumed from the message again.
