Warning: The registration service must be running before any registrations can be made. This can be done using the following command:
./gradlew registration:bootRun
To start we launch the accounts (2222)
and web
services.
accounts
./gradlew accounts:bootRun
web
./gradlew web:bootRun
In the following image we can see how both services are working correctly at the same time as the registration service.
TL (Top Left)
terminal: Account serviceBL (Bottom Left)
terminal: Web serviceR (Right)
terminal: Registration service
Below is an image showing the correct registration of the services.
Now, I proceed to add a new service account (4444)
.
To do this, the port
property located at the following path has been modified: accounts/src/main/resources/application.yml
./gradlew account:bootRun
TL (Top Left)
terminal:Account (2222)
serviceTR (Top Right)
terminal:Account (1111)
serviceBL (Bottom Left)
terminal:Web (3333)
serviceBR (Bottom Right)
terminal:Registration (4444)
service
Below is an image showing the correct registration of the services.
In this one, we can see how there is one instance for the WEB-SERVICE
application and two for the ACCOUNTS-SERVICE
one.
Now, I proceed to shut down the account (2222)
service and see how the web (3333)
service reacts.
For that, I have to press ctrl + c in the account (2222)
terminal.
Now we can see how the web (3333)
service has noticed that the account (2222)
service has been stopped.
To check that the web (3333)
service is working correctly, I accessed the following URL: http://localhost:3333/accounts/123456789
and got the following response:
showing that the web (3333)
service is working correctly because eureka has detected that the account (2222)
service has stopped working and has redirected the request to the account (1111)
service.