1 00:00:01,160 --> 00:00:05,540 We've now got some tests around the expiration complete listener and I feel pretty confident in that 2 00:00:05,540 --> 00:00:10,490 the fact that this thing is probably working as expected but there is one last thing we have to do. 3 00:00:10,700 --> 00:00:15,670 You might recall that back inside of our s our C directories index at T S file. 4 00:00:15,860 --> 00:00:18,220 That is where we are importing all of our different listeners. 5 00:00:18,280 --> 00:00:22,670 And it's where we create a new instance the listener and tell it to start listening for incoming events. 6 00:00:22,670 --> 00:00:26,490 So we have to do that same thing for the expiration that complete listener as well. 7 00:00:27,570 --> 00:00:36,400 Inside of index dot yes at the very top we will import the X operation complete listener from events 8 00:00:36,730 --> 00:00:38,950 listeners expiration complete 9 00:00:42,960 --> 00:00:44,350 then down by the other two listeners. 10 00:00:44,360 --> 00:00:45,510 So we already started up. 11 00:00:45,510 --> 00:00:48,960 We'll do the same exact thing though expiration. 12 00:00:49,140 --> 00:00:58,070 Complete listener with Nats wrapper client and we'll call listen on that thing and that's pretty much 13 00:00:58,070 --> 00:00:58,600 it. 14 00:00:59,300 --> 00:01:05,790 Now if you wanted to test this thing out we could go back or the postman inside a postman we could make 15 00:01:05,790 --> 00:01:07,820 sure that we are currently signed in. 16 00:01:07,830 --> 00:01:15,360 Looks like I still am I can then create a new ticket so I'm at post API slash tickets I'll send that 17 00:01:15,360 --> 00:01:15,810 off. 18 00:01:15,960 --> 00:01:17,600 I'll get my ticket idea right here. 19 00:01:17,730 --> 00:01:23,310 Now I should be able to create a new order and eventually see the order expired or the order cancelled 20 00:01:23,520 --> 00:01:29,990 event get published so I'll go to another tab right here a post request to API slash orders. 21 00:01:29,990 --> 00:01:34,840 I'm going to paste in the ticket I.D. and then send this thing off. 22 00:01:34,880 --> 00:01:40,700 Now if I flip back over inside of Nats I've got my expiration service. 23 00:01:40,740 --> 00:01:45,960 It looks like it received an order created events and after 60 seconds it will publish the expiration 24 00:01:45,960 --> 00:01:53,900 complete event and then in turn our order service should receive that event inside of expiration complete 25 00:01:55,020 --> 00:02:00,980 it should update the status of the order and then eventually publish the order cancel the event as well. 26 00:02:01,020 --> 00:02:05,690 Like I said we should eventually see something that says order canceled. 27 00:02:05,760 --> 00:02:07,600 Now that is going to take 60 seconds or so. 28 00:02:07,620 --> 00:02:11,880 So we're going to end the video right now but I'll leave it up to you to just watch your console watch 29 00:02:11,880 --> 00:02:15,670 your terminal and make sure that you eventually see that event get emitted. 30 00:02:15,680 --> 00:02:16,660 Though this looks good. 31 00:02:16,680 --> 00:02:19,770 Quick pause right here and we're gonna start to move on to our next service in just a moment.