We've now got some tests around the expiration complete listener and I feel pretty confident in that
the fact that this thing is probably working as expected but there is one last thing we have to do.
You might recall that back inside of our s our C directories index at T S file.
That is where we are importing all of our different listeners.
And it's where we create a new instance the listener and tell it to start listening for incoming events.
So we have to do that same thing for the expiration that complete listener as well.
Inside of index dot yes at the very top we will import the X operation complete listener from events
listeners expiration complete
then down by the other two listeners.
So we already started up.
We'll do the same exact thing though expiration.
Complete listener with Nats wrapper client and we'll call listen on that thing and that's pretty much
it.
Now if you wanted to test this thing out we could go back or the postman inside a postman we could make
sure that we are currently signed in.
Looks like I still am I can then create a new ticket so I'm at post API slash tickets I'll send that
off.
I'll get my ticket idea right here.
Now I should be able to create a new order and eventually see the order expired or the order cancelled
event get published so I'll go to another tab right here a post request to API slash orders.
I'm going to paste in the ticket I.D. and then send this thing off.
Now if I flip back over inside of Nats I've got my expiration service.
It looks like it received an order created events and after 60 seconds it will publish the expiration
complete event and then in turn our order service should receive that event inside of expiration complete
it should update the status of the order and then eventually publish the order cancel the event as well.
Like I said we should eventually see something that says order canceled.
Now that is going to take 60 seconds or so.
So we're going to end the video right now but I'll leave it up to you to just watch your console watch
your terminal and make sure that you eventually see that event get emitted.
Though this looks good.
Quick pause right here and we're gonna start to move on to our next service in just a moment.