Now that we've seen the four different types of resources we're gonna have floating around our app going
to take a look at some of the different services that we're going to design to manage each these things.
So in total we're gonna end up with five different services.
We're going to have an authentication service which we'll call simply off this services is going to
be in charge of everything related to a user authentication.
So the sign up process sign in sign out and so on.
Next up we're going to have a ticket service as you guessed this is going to be related to any kind
of ticket creation or editing this ticket service is going to know everything about a given ticket.
So it's going to know its price.
It's going to know whether or not a ticket can be updated and so on.
Next we will have an order service very similar to tickets.
The order service will be in charge of creating a ticket or editing a ticket in any way whatsoever.
Next up we're going to have an expiration service.
This is going to be a very simple service.
It's going to watch for any an order gets created anytime an order is created it's then going to attempt
to cancel that order after 15 minutes has elapsed.
If a user has not already entered in some payment information and then finally we'll have a payment
service.
And once again as you'd guess this is going to handle credit card payments if a user enters in some
credit card information and we successfully charge their card.
We're going to mark the accompanying order that is tied to that payment as succeeding.
Otherwise if for some reason the order is canceled or if the order times out whatever else we're going
to make sure that we mark a order as failed and the accompanying payment as failed as well.
Now one thing you'll notice right away is that we're essentially creating a separate service to manage
each type of resource.
We have four types of resources so user ticket ordered charge.
And we have five different services with the exception of expiration right here.
We are directly creating one exact service to manage each type of resource.
Now is this the best approach.
Is this something we should do for every micro services app.
Well the answer is probably not.
It really comes down to what kind of app you're trying to build.
How many different types of resources you have inside of your application and the amount of business
logic or special handling that is attached to it.
Every different type of resource.
So in the context of a course just to keep this app somewhat simple and straightforward and somewhat
easy to understand it makes a lot of sense for me to show you how to create one service to manage each
type of resource.
But there might be a very different approach that you need to take on your own personal application
when you start making use of this micro services approach.
In particular you might start thinking about how you could create a service to handle each different
feature of your application.
So you might end up with a single micro service to handle just say ticket in order a creation a separate
one to handle incoming payments and handle all aspects of payment.
So for example making sure that you mark a order as being completed and a handle that incoming payment
and then you might have that expiration service tied into that kind of tickets an ordering thing because
it's all kind of very tightly coupled together.
The point here is that it really doesn't always shouldn't it should not be your default to say oh here's
the type of resource I'm going to create a single service to manage it instead it really comes down
to your application and you're you have to put in some thought on how you're going to design the different
services for it.
That's just something all throughout there.
Just make sure it's really clear that even though in this course you and I are creating one service
per type of resource maybe that doesn't always make a ton of sense.
All right just one more quick and a design video right after this one so one more pause and I'll see
you in just a minute.