1 00:00:01,180 --> 00:00:05,890 Well we are all done with our orders and ticket service for now we've got a bunch of publishers. 2 00:00:05,890 --> 00:00:10,780 Listeners wrote handlers inside about them at this point there's definitely a couple of different directions 3 00:00:10,780 --> 00:00:11,680 we could go. 4 00:00:11,680 --> 00:00:16,780 We could go back over to our client project and start to put together the front end for creating orders 5 00:00:16,780 --> 00:00:18,210 and tickets and all that stuff. 6 00:00:18,360 --> 00:00:21,670 But for the rest this course to be honest with you really going to stick on the back end. 7 00:00:21,700 --> 00:00:26,740 And we're only going to revisit the react application when just about all of our backend stuff is done. 8 00:00:26,800 --> 00:00:28,660 That is the real focus of this course overall. 9 00:00:28,660 --> 00:00:34,900 It is really the back end component as opposed to just kind of juggling data in the world of react so 10 00:00:35,000 --> 00:00:35,900 on the back inside. 11 00:00:35,930 --> 00:00:37,810 What is the next thing we're going to do. 12 00:00:37,820 --> 00:00:44,090 Well we're going to take a look at that idea of expiring in order after some period of time. 13 00:00:44,870 --> 00:00:48,290 So this is going to be referred to as the expiration service. 14 00:00:48,320 --> 00:00:51,320 This service is going to have one single job. 15 00:00:51,320 --> 00:00:54,200 It is going to watch for order created coming in. 16 00:00:54,260 --> 00:00:59,420 So we're going to definitely implement a listener inside there and then after that 15 minute timer or 17 00:00:59,420 --> 00:01:04,070 however long we eventually configure it to be we're going to the expiration service then publish an 18 00:01:04,070 --> 00:01:06,610 event of its own called simply expiration. 19 00:01:06,620 --> 00:01:12,170 Complete the goal of this event right here is to tell the order service that one of its orders has now 20 00:01:12,170 --> 00:01:13,390 expired. 21 00:01:13,400 --> 00:01:16,570 Now one thing I want to really highlight that's in this diagram right here. 22 00:01:16,640 --> 00:01:22,700 The expiration service is not responsible for telling the rest of the world then order has been canceled. 23 00:01:22,700 --> 00:01:23,670 That's not his job. 24 00:01:23,720 --> 00:01:27,050 Its sole purpose is to have that 15 minute timer. 25 00:01:27,050 --> 00:01:32,150 It is then up to the order service to take a look at this event and decide whether or not it is actually 26 00:01:32,210 --> 00:01:34,210 time to cancel an order. 27 00:01:34,250 --> 00:01:39,020 This is really important because when this event comes into the Weather Service a user may have already 28 00:01:39,020 --> 00:01:43,460 paid for it in order and we might have not gone over to the expiration service and told it that the 29 00:01:43,460 --> 00:01:49,100 order was paid for and then it should cancel that timer so all this service really does for us. 30 00:01:49,320 --> 00:01:54,510 Listen to order created image expiration complete after 15 minutes or so. 31 00:01:54,510 --> 00:01:58,890 The service is going to be pretty straightforward in nature and certainly a lot easier to put together 32 00:01:58,890 --> 00:02:01,200 than all the other services we put together so far. 33 00:02:01,800 --> 00:02:05,880 It's not gonna have any root handlers won't have any express server nothing like that. 34 00:02:05,910 --> 00:02:10,370 It's really just a listener and a publisher. 35 00:02:10,380 --> 00:02:13,540 Now having said all that of course there's always some hidden complexity. 36 00:02:13,560 --> 00:02:15,060 Always always always. 37 00:02:15,060 --> 00:02:21,660 So the real question about the service comes down to how are we going to let that 15 minute timer lapse. 38 00:02:21,660 --> 00:02:25,860 How are we gonna keep track of it and how are we gonna make sure that we emit an event precisely 15 39 00:02:25,860 --> 00:02:27,080 minutes after. 40 00:02:27,090 --> 00:02:28,390 Well that's a big question. 41 00:02:28,410 --> 00:02:30,440 We've got a couple of different options available to us. 42 00:02:30,480 --> 00:02:31,650 So let's take a pause right here. 43 00:02:31,650 --> 00:02:36,510 We're going to take a look at four or five I think four different options of how we can implement that 44 00:02:36,510 --> 00:02:38,400 timer inside the expiration service.