Designing Microservices using Spring Boot, Spring Cloud, Eureka and Zuul | # 1 | Tech Primers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to tech primers in this video we are going to take a simple example of a stock price viewer and then we are going to create a microservices architecture for the stock price viewer and we are going to choose the different technology stack for the stock price viewer and we are going to proceed with it so if the video takes much longer so what I will do is I will break that into two or three videos so that you guys can continue watching it later I don't want you to bore with the two or three halves of contiguous station but will just break down into 45 minutes or 1 R max ok so I will try to do that so let's go and see how to create this architecture right so we know that ok we need to show the stock price in a UI ok that is what our aim is so we need to give some stock quotation names and then we want the stock price for that particular quote ok so the typical architecture which I have thought is what I am going to present so you can create n number of architectures you can come up with different different types of microservices pattern but whatever I thought was what I have put here so let's see what what what does it look like so typically there will be a web UI so the user is going to access that let's say I am a user I'm going to access that gave you one so we need to design a web UI and then from the web UI to the back-end services I need an API gateway because if there are so many services in the backend I cannot hit with different URLs itay can be deployed in different different hosts or with different port numbers right so what I need is the API gateway so I'm going to hit the API gateway from the web UI ok from the API gateway I am going to hit a service registry so we will see why the service registry is according them in a bit and I'm going to have two different services one called the code maintenance service the other one is called a stock price service so code maintenance service is going to act as a what he called a maintainer write that I act as an admin for adding new quote information for a particular user so if I let's say I want the quote information for Apple and Google so I that quote in maintenance service will add my username with apple and so that I know that okay I need decoding summation for that for those companies right so that is what the code maintenance service is going to do the stock service is going to go to the Yahoo Finance API okay we are going to query the Yahoo Finance API and then retrieve the stock price information real-time okay that is like an external call to the Yahoo Finance so we are going to use a library which are who finance if you provide so we are going to use that right the final one is the DB service so I need to store these quote information from tenet so it's basically a small table it's just two columns one with a user name and the code information so I am just going to store that in the multiple database because I have that running already in my laptop okay so that is what we're going to see so how do we choose these technologies right so we have how many Plus this one two three four five six right almost six processes right so how do we choose different technologies right so I'm going to show you what technologies I have chosen you can choose different technologies as well but time since I have taken lots of tutorials on spring boot and spring cloud services I'm going to use those relevant things so I'm going to show you what are all the technology stack which we can design all these all right the first one would be the UI part so for the UI I am choosing angular so I'm going to use angular basic angular 1.5 406 whatever I'm not going to use angular 2 so I am going to use angularjs okay for the UI parts for the API gateway I'm going to use the spring cloud services so spring cloud services give something called zone proxy so Netflix has created this zone which is going to act as a proxy okay so spring cloud has created a wrapper around that and then made it feasible so that we can use it in a spring butoh plication so we are going to create a springboard application this Zune proxy and which is going to be a sprinkler so this okay so if you're not sure about what is the zone proxy I have made a video on what is owed and what is you reckon you can check that before proceeding this video so that it will be easier for you to understand what it is right so next one would be the service industry I am going to use Eureka so same as zone Netflix has created Eureka and spring cloud services again wrote a wrapper around the Utica and then they made it easy for this pink love spring cloud or the spring mood application so we are going to create another spring good applications that you read kind it okay which is going to act as an intermediary so all these three processes the three services are going to register to the service registry and they can easily interact with the service registry without even knowing the UL so if they can just give a name so if you if you call me how do you call this channel it you call it as text famous you don't have to give a URL to go on so so same way you don't have to give a URL to interact with these different services so instead you can use the service registry to ask that ok give me from the database service you can from the structure which you can ask service registry to say TB service and it will automatically route you to that ok so that is what you records going to do and that is what string service registry tensile force ok ok so literally this diagram doesn't show that everything is connecting to service issue but internally what I'm going to do is I am going to register all these three as a service registry client basically so this will be like a server this will be like a client all these will be register to the server and then who hits the service registry they will be able to round to whatever so will be half ok so this is the unica is there because we need to if you have lots of services like for example stock sales let's say there are two instance of it operates on it so we need to do some load balancing right so directly can do that load balancing ok it can do the local no domestic so you could hit though your service is the state law technically route e2 the service it is free ok that that is why we are using service registry and if the number of certificates throws on right then it is easier for us to hit the service with the service name rather than going with a URL right you don't have to hard code that you are so even if the DB service is deployed in some other machine you don't have to worry about that ok you just need to and you just need to register that with a service industry so that services she knows the new you are but you don't have to know that if you stop so ok so that is why you record use the next one the code so isn't the maintenance service we are going to use the vanilla ring boot application they're going to create a spring MVC application so they're going to explore some western point so that from the API gateway it can be hit the final one is the DB server for the DP service we are going to use this thing boot and the jpe so we are going to use the same API when you spring MVC asset and we are going to use the springing data GP because we are going to interact with the my sequin database okay so it's going to use hibernate so we are going to use ping data GPA for that alright so how I'm going to design this application is I am going to design right from the database service ok till the wait till the UI path so I'm going to take approach of bottom-up approach because if I do a top panel approach I won't be able to test it properly right so in a typical the world or a typical assess scenario what how people design is every Microsoft has a different team or there will be one or two people working on the trigger mechanism so that independently you can create those micro services and independently you can test them and finally they integrate it since I am only one person so what I'm going to do is I'm going to create right from the bottom to the top so that I can easily test if I greater database service I can test with the rest endpoints I will make sure that it is good then I create the stock service then I can create the court mountain service I can individually test them and check if it is all good then I can go further ok so that's what I'm going to do so let's go ahead and get started so I hope you guys understood so this is the typical architecture the typical Microsoft exact attacks which we are going to design I just chose a small example because it shouldn't be like I I create a huge one and the video goes to huge and then you guys don't see it so I just want to make sure that it is as simple as possible that is why I chose this particular example ok so let's go to our typical website so there I always create our springboard application so so as you guys know it is the start of spring dot IO so we cannot have air above this axis there I create all the spring put application so you can like an initializer you just give the dependencies on the artifacts and the group ID name it'll automatically create a project Sumerian project so you can even create dreidel projects here but I prefer creating payment so that you guys understand I think many people don't use cradle but for simplicity I'm going to create a maven project with Java 8 and spring boot 1.56 I don't see any other version so I'm going to use the word final six okay so I'm going to create a what I'm going to do is I'm going to create a group so I'm going to say comm tech primers and I'm going to say since our stock dealer is named as our project his name the stock viewer I'm going to use the group ID called stock viewer and let's say our database service is called TV show so that's what we are going to dig in for strike so for that we need the my sequel connector we need a spring MVC so I am going this and we need the GPA so I am going to use the KP that's it if I'd only ten seconds let's quickly go ahead and create it so I created a folder called story where I'm going to save it there [Music] so let's say I'm going on Tippett time one let's open it on eBay [Music] the project is open so let's see what are the dependencies if you notice here the references are string data JPA the spring MVC the spring web my sequel connector and this thing the startup the string book shutter that is we don't have anything fancy here so I'm going to straight away go ahead and create all the rest endpoints and stuff which we need so I think JDK is not set up let's do this okay getting some basic setups are necessary let me reopen this project I think it entitled the intelligent identify let's go to the new folder so I'll just open it again so that encourages IntelliJ C then create the maven project out of it so stop you okay for some reason it dented it if I still why anyway I'll quickly go and set it up I'm going to say the Java sources is resources with us dead [Music] okay let's quickly the word okay it should go let's train for this closet and it should be good so that's it so let's go ahead and create the rest endpoint so I'm going to quickly go and create the rest endpoint so I'm going to create the package all the source I'm going to create a TB resource so I'm going to say DB further to the fourth okay this is data standpoint which I'm going to expose so that other microphones can use it companies risk controller it goes missing I'm gonna speed up here so if you guys are putting that on too fast you can just pass a video and then take a look so that that is easier for you guys okay lemme just what do I need to returns i need to return the list of course I'm going to say return the only list of strings okay [Music] and this is going to be a fast variable and I'm going to say what is the part variable in the path variable in this username right string usually right okay so next what do we need to do we need to query the database like so gate is going to query the database for that particular user so I'm going to create a repository so I'm going to create the table called coats okay I'm going to create a course table so I'm going to create a quote suppository and I'm going to say fine by user name because that's what we need right and I'm going to give the easy right so let's go and create this particular course for a positive clap so page great should be an interface we are going to use pink it as a play sitter okay so let's go and create this class I want to use it to create another positive package and I am going to extend this from the JPA repository okay we are going to create a entity called quote okay and I am going to use integer you need to create the code before that let's go here and add the annotation called enabled JPA repositories because they are wire JP repository and I'm going to say this package classes okay it's going to be under comm tech primers don't stop don't t be in service don't for positive okay I think I need to give the base package want a class okay yeah so I'm given the packages that's it so let's go to the repository so we need to create this code this model is not there so I'm going to create this under the model package okay and I am going to annotate this with the entity and the table so what is the table name I need the table name as quotes okay I will say quote and then I am going to create it under a database called yes so what are the frames which I need I need an integer field is going to be writing and in the username field and creating user name right and 980 list of codes right basically since these are individual records so I am going to say code I need in detail code let's name the tabular scores that should be it so I think and create this also as codes but it's going to have only one quote and let it be code fine I don't care what the table name is but yeah so I'm going to annotate it but that ID is going to be generated value so it's going to be auto-generated so what I'm going to do is I'm going to create this as a auto-generated value okay I'm going to create the strategies or both right so that good case automatically and I'm going to annotate it with the column and I'm going to provide the name as reading okay we don't have to do that but just for some readability purpose I'm going at it as okay and here I'm going to create these are the column names of what this I'm going to give it to for the middle school so I'm going to create some getters and setters [Music] so I'm going to create a concept or is going to be an empty constructor for the GPA right that's it so we have care to the code we have greater therefore the tray we have created the resource and everything is ready we just need to create this particular method so I'm going to create this method in the Apocrypha and we need to get the list of who okay right so once we get the list what do we need to do with a list right we need to do something with a list so I'm going to okay I'm going to so this is going to return less so I'm going to do a stream so what do I need I need to get only the quote information return it right because we need to return the list of things so what I'm going to do is I'm going to return so we have the quote information here okay from the code I need to get only the get-go right what I'm going to do is I'm going to return only this and since I need to tell this is a list okay I need to collect this I'm going to do a collector dog to list okay that's it and I can simplify this I can replace this with a method reference again also I need to get on this right that's it so what I have done here is I am querying the repository for that particular user and then collecting only the quotes okay and then I'm sending it back to the rest endpoint right let's quickly do a test right so we wrote some code I don't know if it is going to work so let's quickly do a test so that we can proceed with the next endpoint but meanwhile when the meanwhile if the process and the process comes up let's quickly create some both mapping where I'm going to add a user right I'm going to say add I'm going to add is the name on the code so here we just retrieve the information but we need to add as well right so I'm going to create it so I don't want to waste any much time so I'm going to I know we do that I'm going to say add and I'm going to say request body you need a quotes and it codes to be think it was insane I cannot remember things yeah I think I haven't given the database details I said so what I'm going to do is I'm going to use some different port numbers so I'm going to say server tour for equal to 8 3 double zero I'm going to use this particular port and I'm going to give some application in sis playing that application of name I'm going to say it is a DB server right and also I need team Icicle properties so what I have done is I have already created some property I'm just going to use that I just use the spring or the Kindle it is like template so I have stored it like this I have stole it to the shore fact if I do add a bit we're going to face that for me automatically so that is what it will thought that what is more fanciful faster got to go against the mine can pick from intelligent okay so we have created all the properties they'll get to the port I think that is it going to be continuous yeah so let's go ahead and create this class so I'm going to create one more class called quotes that is going to be the model which the user is going to push so yeah there is no error that's quickly run this I mean when we can create it yeah let it quickly run or I'll just go through a compilation error so let's not write any code until this comes up [Music] meanwhile I have the postman here so the URL would be JTP : / / localhost colon a little / yes / TB / what is a username I just let say for some point escaped eater okay there is a nullpointerexception oh yeah I think I know why it's an enfant exceptions happened so this is because they didn't instantiate this repository we just created it we just do auto wiring I am just doing the construction constructor injection so now this should fit an empty response so I have restart with application of attack since Leslie if it returns empty response VSS okay our application is working our plumbing is working is going to the database we can plate as a table in the database so yeah so if you notice here here I have given the spring jbi hibernate DDL authorize update this is going to automatically create the table if it is not existing so let's go to the postman and came to send again it should return empty response actually I had created some table already so that is why you see here Peter has a data for Google and Apple okay so if I give some name Sam it's going to return empty code yeah we are getting the data getting a response food now what I'm going to do is I'm going to add the post method so they have greater the force method but we haven't done anything right so we have created a POJO here what i'm gonna do is i'm going to add some basil so this is going to be the json which the user is going to push using the post method okay so what I will do is I am just give this right so we need the list of quotes and the user right that's it so I'm going to create a greater than set of right and I'm going to create some constructor right so that is it okay so I'm going to create some empty constructor as an item like that will be relevant but yeah let's go and create it so I'm going to use that particular course okay and I'm going to again T quotes information and I need to insert these right so what I'm going to do is I'm going to iterate through this strain so that I get all the code information and I need to purchase that right so I'm going to use for each so I'll get the code like I will get the code information so I'm going to use be repository right and I'm going to say say okay while doing the same I need to create a new codes of code object right I need to create a code object isn't it so the code object is nothing but the object which we created here right so let's add some constructor so I'm going to add the consequencies name input so what we can do here we can operate the username and the quotes information okay what is going to do is it is going to I trade this list of quotes and it is going to insert for the same username so that's what I'm doing here I'm going to I'm going to do is save on creation of new code every day okay in fact I can even do a map and then make it much simpler so I can do constrains I can do that so I can just say you oh of course dog get you in a coma and then in the for each I can just do a favor this school I can do the sensor so this make the functional programming stuff like I can do this so what if you see here I have just creating a new quote object which I need to be using the repository so finally what I need to do is I am going to return the list of codes which got added so I will what I will do I will just use this weather so I'm gonna enclose this inside the get username get close by using I'm going to use that I'm gonna tables that get post by easily remove it oh my dear again so that lady came here to that one this function can be be used you can just move it down so we have added a post which is doing an ad right so let's quickly test this so that we don't get blocked and meanwhile we can add a new one to do daily so we have added at yet we have added a add and then we will be adding a digit let's switch click as the ad now I mean well let's go to the postman I'm going to see it I need to pass I need to create a post right so I'll do a post and I am going to say add that is for another standpoint of that Debbie act and I need to pass the content type in the header I'm going to say it is [Music] okay so in the body I need to pass something right so what I need to pass using so what I need to pass to say wrong and I need to pass a JSON message so I need to pass the username which I'm going to say is Sam okay I need to and I need to pass the list of codes right so I'm going to say course and I'm going to pass then it's tough code so in this particular case I'm going to say only Google ok I'm not interested in more than one so I'm going to say I'm going to add this particular information okay so let's see if the process is up yeah the process is up I'm going to quickly go and hit the send button so this is going to return me a list of objects so what has happened did it return unsupported media-type why is it I just say ah I think I didn't type it fully content type let's just do the send again this is going to add yeah if you notice here it has added and it is giving me what is the list of list of quotes for that particular user so I'm going to do a query of salmon and I'm going to see if it is correct okay so I think it is it looking should override a target so what is I forget it okay so and what get here okay code if I reduce spam I'm getting Google okay so it is correct so ad got worked so I'm going to quickly add the delete option and then I'm going to finish off this particular address this particular Microsoft so I'm going to say Tilly [Music] okay [Music] you want me to get just pawns I'm going to say I'll just certain boolean or just say dilute and let's add it editable or permit so let's say we can delete only the user okay we can modify this later if we need more methods but just for the initial testing purpose I'm going to have only okay what I'm gonna do here is I'm going to say it or delete and you need a quote what we can do is we can say new hole usually but I don't know if it will boy so what we can do here is instead of doing this I'm going to query all the final username easily and we have the list of quote information and I'm going to pass this decline if you see here we have the list of code and I'm going to pass this clicking delete so that we are going to delete all those and I'm gonna say return true or if I want to query what I will do is I'll just say query by this so that we can confirm that there is nothing so this basically will turn always empty response so that people know it's empty so it is here what I have done is and querying for the username and I'm getting the all the codes and I am deleting them okay just was a safety purpose nothing it bite on three starters and I will quickly test this and move on to the next one right so let's go to postman for the post I need to delete right I'm going to say delete Sam right and there is no body request I am gonna say nothing okay get this comma with the storm of yep just come up so I'll just quickly do the same yeah if you notice here nothing is coming so if I go to get done to train staff I am getting nothing so luckily it got deleted okay so our microservice is ready so the Debbie microservice you can see the baby service is ready now so any process can use the DB service to add or delete or retrieve e-coat information for a particular user right the next one what we will do is we will create a stock so okay so one of the Microsoft's is ready so next we will do a stock service creation so I'm going to create stock service so for this talk service we need the spring MVC we don't need JPA as such because we're not going to get a database operation and I think we need to do anything else I think we need the you take our client okay you need to do the you record discovery because we are going to add this here a cursor in stock service as a trying to D you wreck us over okay basically the service existed so that is where we need to mount in the next line so that's why I'm adding the you take our discovery question point I dependency okay so let's quickly create this okay I'm going to create it in the same location that existed [Music] okay to dump it let's go to IntelliJ and open it so what I will do is I will stop this guy and bring it when we test it right so that we don't mess that up we'll just all funny mean stuff feels a little loose topsoil that's no good so it's doing an import the other thing is saying this since this spring both version is new I think if my downloads my spring cloud dependencies so it might take few minutes I believe because it's going to download it for the first time because I have not started a project with spring flood one hot side of it so it needs to download all the new jars which take all right and before that way let's go through what is there in the palm products um if you notice here the bomb has a spring cloud start and Eureka this is what I was mentioning so this is going to give us being your discovering your client from Shanti and we are going to use spring both spring MVC right to springboard shot of F that's it you're not going to have anything else and the other thing which we are going to adhere to this is you're going to add the Yahoo Finance API so I'm going to customly add that so I'm going to add Yahoo I have already added a template so I I have added that depends here so the Yahoo Finance API this is the non TPA and the version is 3.6.13 use okay so let's see the project structure look structure is good so I'm going to annotate it this with the Eureka client because this is going to be a client right so I wanna take this city client so you don't have to do anything else if you see the difficulty you reckon implementation you have to do so many things but spring cloud services is doing this annotation magic right so it is those things still is saying that okay you add just an annotation I will take care of all those the string I'll take care of discovery and stuff like that and the other thing what we need to do for this particular client is we need to add some properties in the application yeah okay so what I am going to do is I'm going to add some property so I am going to say that okay my eureka server is going to be running in this particular report okay and it's going to be running in the localhost and i'm saying that register with you regards to for the client and say that fetch the registry to so this is going to give me be ready information this is just the conjugation which we need so right now there is no server running here but still I have just mentioned it so that we will have a dump and running when will be created ok let's create a rest endpoint so what we need to do is we need to expose this rest endpoint so that from the UI if you hit this particular process if the user is going to give the user name with a user name we are going to query the database service and then we are going to return it back right that's what we are so we are going to return the we are going to get the quote information and using the port information we are going to go to the Yahoo Finance API and so let's go and create peace resource so once I start creating waiting you will because you'll understand so I'll create a stock resource ok you want to use the rest controller one use this mapping and I'm going to say rest - stop stop and I'm going to say game ad stock information for the username I'm gonna have only diesel and the I don't know what object OTP so I think it is a stock book we can return the stock hope information let it stop so what also we need to ability part variable is the name I'm gonna store this inside still easily right so we have the username now we need to query the other TV service right so we need to query the DB service so what do we need is we need the rest template so we are going to use the rest template okay and I'm going to oughta wear this so we cannot Ottawa just like that so what I'm going to do is I'm going to create a convict class where we can add the beam creation so that it can be created only one okay so what I have done here okay so I'll just created a new beam so that I can auto wire later in other to other for example in East officers I have Auto wearing automatically so that it can create that as template only one and spring both will know that it has to do the load balancing right and this class is going to be a configuration class so I'm going to rotate it the add configuration okay that's so we don't need anything else we can in fact even we can move those there okay that's not a big deal okay so the road at load balance is going to do the client-side load balancing you can see here it is coming from the spring cloud client okay so this is going to do the client set roll load balancing when we are using the Eureka you wrecker service okay so I will show that when it is used right so for now what we are going to do is we are going to use is the custom plate and since we are not going to have the eureka server created yet i am going to hit the URL up e rest endpoint directly so I'm going to use get okay I'm going to use get four objects so I'm going to say this shady pecan little to what was the port number eight three double zero right a tree double zero slash red slash TV slash our username right okay and then what do we need so what do the definition here I need the class of response type I think they give a string rate I think they give this okay and I am going to store this into photogenic boots it's going to be a list of course credit so instead I can now instead of using get object in fact I can use the exchange so I'm not sure if I can easily use it right yep so I'm going to say this URL [Music] use this particular URL and I'm going to use get okay they're going to get order the new stone parameter it should be entity do we need to give a if entity I don't think we need it and then we don't need a sequence T we need to get the response of result so what is the definition is given I need the class of type T right so what class is that I think it's going to be a list right so I but I need a parameter is a couple so I won't give a parameter of type depends on which is a new parameter ice type reference of list of strings that one may be right you need to edit anything from this will the system be empty okay so what I am going to get here is a response object right I need a pork response I will be getting a cold response and from the response I can get the body which is going to give me the coats which is going to be the coats so what I have here is the list of course from the list of course what I'm going to do right I think I can not give the name course because I am scared of over here and just delete it because that's not require know to say anything the exchange right so I'm going to use the quotes so I'm going to do a string so for every code what I need to do I need to do a mapping so for every code what I am going to do is I need to query the Yahoo Finance API so I'm going to create Yahoo Finance I'm going to use this I hope no one's done oh-ho what is the class wanna be with it kanta is Yahoo Finance let's see I don't remember what was it you think it's Yahoo Finance what was the I think something oh there's some cool boss Kato but nothing is coming right now to the mind so let's quickly go and see the API so I have created I have created a suppository I think I created a project on that so let's quickly go and check it so I crater the reactor for example with that so I'm going to only check what are they exactly PA so I don't remember exactly what was the method name completely tragic here [Music] okay it's going to be oh it's going to be a static thing okay I can just the way you are open arms or get off with right can do that so I'm going to say rock new plans or get off yeah you have the symbol so if there is a let me check it will be too fast clean list oh nothing alright so what I'm going to do is I'm going to pass the code so that we get the port information right and we need to collect it with those dot two lists okay that's it and this can be done here we don't leave this we don't need any of this object because it's a static method and if we there is the i-word solution and you say is it wearable paper or physics inside this guy and this is the try catch okay fine and close to the concoction-- put this inside our third pit stop okay so I'm gonna replace this with a tree method results so that it's easier for me here I staged a little in code what does it stop so I need a stop here so - Yahoo structure I think I have to put the stock here as well right okay so we have collected this information and when and when it is returned this that's it good so what does this is done here if there is a catch I think I need to return click on create the stock I think I can create a super simple but I can create a pretty good if there is an exception I am is gonna crater and the stock okay so that does it so what we are going to do here is what we are doing here is there we have it addressed in point called rest us better slash stock and I have created a get mapping for the username and we are using the username and we are querying the other baby service and then we are getting all the list of code information and then we are querying the Yahoo API and then we are going to trigger it right trigger T we are going to return a response right so let's start this guy meanwhile I need to add the port information right so what I'm going to do is I'm going to say I'm gonna make myself stop sauce and for the server I'm going to give the port number as a three zero one okay right let's bring this up meanwhile I will open the other project to change without loss of blemish hello from the DB service trial during the DB server so that when we hit this particular standpoint it is going to connect to the DB servers and then give us a response for the courts which are there in the DB okay and just triggered the bill just it at the top let's see if it is coming in hope it comes up because the service registry is not something so it should fail the there should be some keepalive are not here so I'll just show you what it I we just poles and sex if the server's is running or not because this is how you write our client right so here month is as you take a client so this is going to do a poll I hope it should not fail so it yeah I sitting here it's doing a initializing a decline the day then something contained stone jumping it failed okay yeah yeah the query failed cannot agree because because it's not the server is normal so we've done because we having to hire a bit meanwhile the porters come up so the process is up what we can do is we can hit this particular standpoint so what are the rest endpoint we are having a resting point faultless slash top slashing on it right and let's check another yeah the other ones also the DB service is also up at the 18 double zero what I'm going to do is I'm going to go to the TV service alright so I'm going to add the Sam so I deleted some previously read so let's go and check if Sam is there I don't think it is it yeah Sam isn't it so I'm going to act them for the Google stock line okay Sam has got added let's query in sick one okay Sam got added what I'm going to do is I'm going to hit the six eight three zero one so I'm going to hit these talk service and then I am going to check if the stock price is getting three so the rest endpoint is the rest class talk / Sam so I am going to hit the send button let's see if the data is working so it is saying no instance is available for localhost one so the database query came if you notice here the I see the database query came here but there is some problem here there is a connection refused so this is coming because of the spring oh okay so I think I know why that is coming because I have added load balance here so I will not do that let's restart it yeah there was a Replicators client-side whole balancing using it open so it is identifying if that practical service is there or not so that is why I think everything is getting it open - if this is not coming up what I will do is I will disable the year dependency here so that it is not connecting to any server so let's try let's try this one more time you take out that particular annotation or as what I what I will do is I will just disabled this particular definition then we will just test it later on when the server suggesting server is created we can enable it but also its up again so let's hit it and see [Music] it's telling saying unknown post exception why is it unknown horse exception I think it's not able to connect to the Apple I Jack right yeah that's what I do if you go to the exception is for the i yahoo i chart yeah it's not able to connect physically but it will fill the information right and it was completed it's better I'll disable this disguise so next enable the Eureka server so back pxk from the Govinda's also ok and also leave application we often Oakland come on [Music] tomorrow you a little starter [Music] tokido be sugars or not you hope Bob I should not be any exception we got that look a little up and it's great to go and simply get option tell me that is an exception to the staying on board under the host exception so why is it coming away but also that the board information got your trade I'm not sure why that is coming okay so see here the Google's alphabet information about literacy and it is getting fast but still it through a long post adoption right yeah I don't know if what happened to be after you API maybe the I chartered yahoo.com it settles down or something I'm not sure right so what I lose and go ahead and check if that is a new API which is available so what I will do is I'll go ahead and check that okay okay so I'm check if the version as a second Yahoo Finance API website whether the version is go Donna so meanwhile let's go to the architecture so if you notice here what we have done is we have created the tabi service and we have kicked at the stock service we need to create the service registry so what we will do is we'll quickly create a service register you make a server so let's go to the thing initializer so I'm going to create a new data source okay and I'm going to say it's going to be a bib and it's going to be a wrecker service so that's what we are going to select here and I think that is it we don't need any other difference right so I'm going to create the project and we let's quickly create that okay so and then with this particular services education and stop the video so that we will just regroup again in the next video with the character the Yahoo Finance API so I'll just correct that whatever whatever is the latest right so let's quickly unzip it okay and with the successful let's go to IntelliJ and quickly open that [Music] okay justice for all just opened okay the consumers so I think this also may take some time to do the import because this is the first time I'm using this version so it needs to download all the record silver property hopefully it should be done between that's it okay Colette has done it good for us so that's it what we need to do is we need to create a the annotation here called the add in a balloon you don't cross ever okay we are going to add the annotation call única server so this is going to be the server okay with which other processes are going to connect and we need to create application numbers similar to how we created they're in the other processes I'm going to create the application gamble I'm gonna name this application we're bringing application name as you the cards over right and I'm go go say idea properties of self so I'm going to say that this particular project is not a client so disable and don't fetch me the registry information because I am going to directly it so that's what I wanted okay so that's it that is all we need so this is going to be the the records also be noted here things the small spoon would application which is just going to behave as we take a server that is what we are going to get ok let's go ahead and start this particular server ok so one starter this is going to be the server and it is going to have a dashboard okay from the dashboard we can see that what are the different clients which have got registered and stuff like that right so let this come up okay if you see here by default it comes up and in this particular book okay let's go and then okay because we notice here this is almost similar to the URL which we gave to the other projects so let's go ahead and quickly see I think this is saying already in use so what I'm going to do is I'm going to give a different I'm going to say a 3:02 right let's see if it is coming up a third [Music] [Music] okay something's coming up yeah if you notice here I think it is up yep our server is up let's quickly go to the browser and I'll show you any dashboard for this what is the browsers and browser is here so if you see the low close eight seven six one that is where the server is running but let's see where you see a little thing they created it out smooth a Roger apply in create to the zero to yeah okay so I don't need to give the eureka so if you notice here in the dashboard so you can see this is Erica so this shows what all the different applications which are registered with e you recover so this is going to be the server if you notice here there are no instance which are available here right now so what I'm going to do is I'm going to disable what we I'm going to enable what we disabled here right and I'm going to bring this up and we are going to see what is happening [Music] okay so I think [Music] so the more important okay put a successful isn't a living okay so let me bring this yeah so once this comes up there's going to be a client and the client is going to be register here if you'll notice here there are no instances right now to disturb because there are no clients right now running but we need the clients rate so let that particular server come up and they should not see any failure here are I think we have to give the eureka so yeah I need to give the port number here so I have written wait three zero two right so we are it with you that it will be repose and LT started here so this particular client is now going to connect with this particular server okay if you notice here it has connected already it is connected using the stock price and it is saying that it is under support 8301 right so let's go ahead and check if this us come up here so yeah if you notice here the stock price is showing up here okay so instance apparently registered with a eureka this is what is happening here right great right so now we have a DB service as well so we register the stock service with it we have the DB service as well let's register TBB service as well so what I'm going to do is I'm going to go to the form add the same dependency so getting that dependency so I'm going to add that also as a client so I'm going to add this guy also here so that the DB service is also registered VD you record server so that you can easily access from the stock service to the DB source using the name achill so we don't have to do that that's what we are going to do here so let it both have running main one I'll create the application yeah [Music] and my new thing you take a breakup client okay when it's needed and a port number is a 3:02 so I'm going to add a notation called enable you recall I know committing call the forum did it get I think I have to add the bring boots spring cloud sell property see a little artistic thank God wasn't and you okay just needs to be imported and is getting in football [Music] okay we need to stall so wmm is really specific [Music] hopefully this should resolve the import problem to students with editorial [Music] it's still in large majority so let's go and check whatever things are heated so apart from them do you need anything else we the Utica stocking that's it doesn't need this here and then I 2250 recorded [Music] and unfortunate okay and shouldn't have put this here here should have been here and they put this back of all oh yeah that's the import now we've gone okay yeah no a little bit yeah cook so what I'm going to do is I'm going to restart this guy again so that this is going to behave as a client again and it is done will now be registered with these silver fir so right now which is you only the stock services register we need the DBQ is also to be register here and let it come up as this comber I think DB service is coming up so I will close the or this particular session with this particular registration and I will just summarize what we did so that we can continue from the next Microsoft in the next this next video okay so yes the process goes up let's refresh this page okay so emergency you recommend being correctly claiming instances of when they are not the annuals are less than official so I think this is because all right if the unica things that some of the services down but it that is that is the reason it is showing um that better okay you can ignore it for now so we have the DB service registered as well and also the socks of is registered so if let's see the architecture diagram what we have done here so if you notice here we have registered both the stock service on the db7 onto the registry service industry okay so from the stock service you can easily access this DB service via the service name instead of tu one okay so I will show that in the next session okay for this particular video we just created an architecture so this is going to be the architecture for the microphones which we are designing be creativity be civil with the different dress ten points we are going to add David and get the code information for every user and stock service is going to connect to the Yahoo Finance API and get a stock information and it is going to go into the DB service to carry all the coding finish for a particular user and using that quote information it's going to go to the offices and safety and get and also we have cricket the service registry this is going to be the unica server and we connected the stock servers on the DB service to the service registry and we saw that in the dashboard that these both are getting registered to this particular server so in the future in the next video which we create the API gateway in the zip so from the web we will be able to easily from the API gateway will be able to easily route to T different services from the stock sale from the service it is to basically the user customers which we created ok so that is what we are going to see in the next video and I hope you understood everything you know whatever waited in this particular video so we have created three different micro services we created all these three using the spin boat application and this thing you reckon spring cloud services so if you have any doubts regarding that properties in the comments below I will be able to help you with that you can try this program as well from in your local system if you don't have any might be called a tables you can use H to instead of the my sequin connector database or the my sequel of dependency you'll be host to database ok are also trying to push this code into the github repository so that you guys can download that from there ok so that's it for this particular video we keep it in the next video we will cover these remaining now micro services and we will create an end-to-end working prototype ok hope you guys understood whatever we discussed in this particular video video again in the next video thank you very much [Music]
Info
Channel: Tech Primers
Views: 280,887
Rating: 4.8394604 out of 5
Keywords: spring cloud zuul, spring boot cloud, spring cloud eureka, spring service discovery, spring resiliency, spring cloud zuul eureka hystrix, zuul example, spring cloud zuul example, spring boot microservices, microservices example using spring boot, microservices using spring cloud, microservices using spring, spring cloud microservices, microservices example in java, microservices example in spring boot, microservices example in spring cloud, stock price viewer, netflix eureka
Id: rlS9eH5tEnY
Channel Id: undefined
Length: 66min 33sec (3993 seconds)
Published: Wed Aug 02 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.