1 00:00:01,070 --> 00:00:04,850 Now that we've seen the four different types of resources we're gonna have floating around our app going 2 00:00:04,850 --> 00:00:09,870 to take a look at some of the different services that we're going to design to manage each these things. 3 00:00:09,890 --> 00:00:13,360 So in total we're gonna end up with five different services. 4 00:00:13,490 --> 00:00:18,140 We're going to have an authentication service which we'll call simply off this services is going to 5 00:00:18,140 --> 00:00:21,600 be in charge of everything related to a user authentication. 6 00:00:21,650 --> 00:00:26,170 So the sign up process sign in sign out and so on. 7 00:00:26,190 --> 00:00:31,320 Next up we're going to have a ticket service as you guessed this is going to be related to any kind 8 00:00:31,350 --> 00:00:36,690 of ticket creation or editing this ticket service is going to know everything about a given ticket. 9 00:00:36,690 --> 00:00:38,100 So it's going to know its price. 10 00:00:38,100 --> 00:00:40,990 It's going to know whether or not a ticket can be updated and so on. 11 00:00:42,240 --> 00:00:45,870 Next we will have an order service very similar to tickets. 12 00:00:45,870 --> 00:00:52,540 The order service will be in charge of creating a ticket or editing a ticket in any way whatsoever. 13 00:00:52,540 --> 00:00:54,840 Next up we're going to have an expiration service. 14 00:00:54,850 --> 00:00:56,810 This is going to be a very simple service. 15 00:00:56,830 --> 00:01:02,110 It's going to watch for any an order gets created anytime an order is created it's then going to attempt 16 00:01:02,110 --> 00:01:05,370 to cancel that order after 15 minutes has elapsed. 17 00:01:05,380 --> 00:01:11,360 If a user has not already entered in some payment information and then finally we'll have a payment 18 00:01:11,360 --> 00:01:12,200 service. 19 00:01:12,200 --> 00:01:17,540 And once again as you'd guess this is going to handle credit card payments if a user enters in some 20 00:01:17,630 --> 00:01:20,560 credit card information and we successfully charge their card. 21 00:01:20,660 --> 00:01:24,940 We're going to mark the accompanying order that is tied to that payment as succeeding. 22 00:01:25,010 --> 00:01:30,590 Otherwise if for some reason the order is canceled or if the order times out whatever else we're going 23 00:01:30,590 --> 00:01:36,530 to make sure that we mark a order as failed and the accompanying payment as failed as well. 24 00:01:36,530 --> 00:01:40,580 Now one thing you'll notice right away is that we're essentially creating a separate service to manage 25 00:01:40,730 --> 00:01:42,840 each type of resource. 26 00:01:42,920 --> 00:01:46,690 We have four types of resources so user ticket ordered charge. 27 00:01:46,790 --> 00:01:50,970 And we have five different services with the exception of expiration right here. 28 00:01:50,990 --> 00:01:56,650 We are directly creating one exact service to manage each type of resource. 29 00:01:56,660 --> 00:01:58,410 Now is this the best approach. 30 00:01:58,430 --> 00:02:01,130 Is this something we should do for every micro services app. 31 00:02:01,160 --> 00:02:03,900 Well the answer is probably not. 32 00:02:03,920 --> 00:02:07,110 It really comes down to what kind of app you're trying to build. 33 00:02:07,160 --> 00:02:11,300 How many different types of resources you have inside of your application and the amount of business 34 00:02:11,300 --> 00:02:13,950 logic or special handling that is attached to it. 35 00:02:14,060 --> 00:02:15,440 Every different type of resource. 36 00:02:16,020 --> 00:02:21,080 So in the context of a course just to keep this app somewhat simple and straightforward and somewhat 37 00:02:21,110 --> 00:02:26,480 easy to understand it makes a lot of sense for me to show you how to create one service to manage each 38 00:02:26,480 --> 00:02:28,190 type of resource. 39 00:02:28,190 --> 00:02:32,690 But there might be a very different approach that you need to take on your own personal application 40 00:02:32,720 --> 00:02:35,810 when you start making use of this micro services approach. 41 00:02:35,810 --> 00:02:39,800 In particular you might start thinking about how you could create a service to handle each different 42 00:02:40,010 --> 00:02:42,170 feature of your application. 43 00:02:42,170 --> 00:02:48,850 So you might end up with a single micro service to handle just say ticket in order a creation a separate 44 00:02:48,850 --> 00:02:53,140 one to handle incoming payments and handle all aspects of payment. 45 00:02:53,140 --> 00:02:58,810 So for example making sure that you mark a order as being completed and a handle that incoming payment 46 00:02:59,060 --> 00:03:05,140 and then you might have that expiration service tied into that kind of tickets an ordering thing because 47 00:03:05,140 --> 00:03:07,480 it's all kind of very tightly coupled together. 48 00:03:07,480 --> 00:03:12,820 The point here is that it really doesn't always shouldn't it should not be your default to say oh here's 49 00:03:12,820 --> 00:03:17,260 the type of resource I'm going to create a single service to manage it instead it really comes down 50 00:03:17,260 --> 00:03:20,980 to your application and you're you have to put in some thought on how you're going to design the different 51 00:03:20,980 --> 00:03:22,130 services for it. 52 00:03:22,180 --> 00:03:23,620 That's just something all throughout there. 53 00:03:23,620 --> 00:03:27,310 Just make sure it's really clear that even though in this course you and I are creating one service 54 00:03:27,340 --> 00:03:31,780 per type of resource maybe that doesn't always make a ton of sense. 55 00:03:31,810 --> 00:03:36,520 All right just one more quick and a design video right after this one so one more pause and I'll see 56 00:03:36,520 --> 00:03:37,660 you in just a minute.