Okay in this lab we're going to have service one talk to a new service called service two using the ribbon project. Now, I've brought in the solutions because I will be too slow in typing. But basically this is your service one here and this is your Eureka server that you've already created. So first things first, what I often do is that I stopped my Eureka service running and I just stop all my other services running and then I just relaunch them again. So I'll just start Eureka here. And the first thing we asked you to do is actually in your service here, service 01. Notice, I just have the one thing running. So if you want to stop any services, just click the red button, it will stop them. And we ask you to put in this class a new annotation ribbon client, name service two on your class. Service here one class. And down here we've got a new implementation of our single method. Receiving an idea in getting a mountain. It's actually going to be delegating down to this URL. Well that's a really weird looking URL. Service two and that's the point of ribbon were actually hiding the IP address and the host name where this service is. And that's actually going to be going against the ribbon servant list, which is the local registry of Eureka services that is constantly pulling back down from Eureka and making copies of in the local registry. And in that local registry will actually be this is where we make the call to the IP address, the DNS entry etc. So when we come down to the next line we create a rest template and we do a get for object against that URL that's encapsulating where we're actually making the call to. Now, since we're using ribbon, we also asked you to create this rest template. There's a Bing definition. Remember this is a spring configuration class, as well as the application class, as well as a means of discovery client to discovery of running Eureka server and arrest controller, it's everything. It's a very small service and that's going to be load balance and that immediately is going to use ribbon because that's on our class path. As a means to say, well, I've got the service URL a rest template you need to make a call to this URL to this service. And as we'll see you later, it does a round robin. So if it basically says, I have to service two entries in my local registry. Well, we'll go to the first one first and then on the next request will go to the next one and then revert back first again as each request will access the delegation down to the second service in a round Robin Manner. So that was our code in service 01. Now we have to go to the yaml file in service 01 and take a look at what we added here. And we kind of gave you the code here. But notice this is service hyphen to that matches the ribbon client configuration we had in our class. There it is service two and the URL service two. That's not the name of the service. The service is actually service 02 and you're using this class here to go through the ribbon service list saying where are my entries for service 02 because that's where we want to go. So back in our service 01 class we can see that once we make a successful call to this other service service to we're going to set a new property on our mountain class. So that means you would just have to come in here. Just added it. We're together in santa and we'll be good to go. I think that's it for service once. So I'll load him up hopefully into Eureka where it will register itself and pull down a copy of the Eureka service into its local registry. Of course that's empty. While that's starting up. Let's open up service to so this was in your student work. You have gone to set up that 3.1 and you have opened this guy brought the solution in to save me typing time. It's not an awful lot in it. This is a small DAO which returns the date that a mountain was first successfully conquered, so to speak. We have a service 02 class, which is also a spring application class. So we ask you to put enable discovery clients. So it will try and register itself the running service. We've got an injected down where it will delegate down to the dow and this one we're just returning a string. It's not even Jason were just returning the date, whatever it may be as a string. Okay so, we've hopefully register himself there, but we've got one other thing to do and that is to come into the and we would have given it the name. Service zero to Hey, I'm trying to register with Eureka. Where is it? It's here, hey, I have a local registry. Often should I renew it? The metadata we gave you. And if I don't seem to have a service from Eureka after a certain period of time when I keep renewing my local registry, I'll eventually take it out. We're running on Port 80-85. Let's see, we've got a couple of councils. First thing I'm going to check his service 01 registered. Looks good to me there. It is nicely registered getting its local registry there. Let's let's launch service to now. We have three consoles. Let's see if service to successfully registers with, yep. There it goes, it's been accepted. Okay, so now I'll go to Firefox, Local host 111. See we've got, yep, I've got both services registered very good. Now remember they both got copies of the registry that you're now looking at locally. So service to has in its local registry, Service one, but more importantly for us in this lab, service one has in its local registry. Service to And that registry contains the address DNS entry, and host name. Where is this service to running? So let's see remember when we looked at the code here in service one, if we go to the rest controller. If I come into here, it's going to delegate down to service two curtesy of the yaml, it's going to look in the registry for a really service 02. It's got a load balance for us template that will make the call. The string will come back will set it in the mountain when it was first concord, so to speak. So let's see if that's working. So I come into here very good. Got that little warning error again because of our environment. So local host, so we're going directly against service one here will service one fine service to via Its local registry is the question. And there you are, we've got it, there it is. It's like an apparel was conquered in 1950 and we've got a couple of others 1936. So we are going through from service one to serve as to via ribbon.