Services
ServiceRegistry
Log Tracing
API Gateway
Hytsrix
All the microservices will be connected to the service registry,
so that we call get an idea about what all the microservices
available and the status of all the microservices.
All the requests will be sent to API Gateway first then they are
forwarded to corresponding services via url reference or pattern.
Using timeout , we can check whether a particular service is working
or not. A fallback method will be triggered in case the response is
not generated in a given time frame doesn't work.
Using Hystrix Circuit Breaker we can visualise how much the api
endpoints are failing and how much are getting successful. And
which microservice is not working.
Repeated configurations can be placed at config service as it is
not a best practice to include them at all the services.
Distributed logging can be to identify which microservice is getting
failed and where the request is traversing.
For this , we can make use of sleuth and zipkin server , zipkin client at the services.
Sleuth provides multiple flags like service id using which we can identify which of the services
is getting called , ( service ) application name, traceid ( unique id along the entire request , same for all the services ) , spanid ( one span id for each and every service) and exportable flag.
traceId: It is a unique Id assigned to the request and is the same across all the microservices. spanId: It is a unique Id assigned to each operation. exportable: It is a boolean value and represents whether the log should be exported to Zipkin or not.
For centralised logging frameframework we can also implement elk stack
For 2 microservices we can easily make api calls but when there are multiple microservices
exchanging info. b/w them becomes difficult . And also scaling will not be so easy.
We can create a service registry and it will maintain all the endpoints for it. It will have information about all the microservices including their status updated , url info. and port no.
Requests will come to API Gateway first and based on url pattern , they will be traversed.
application.yml can be used for the ApplicationContext . Whenever the application starts, spring boot will make use of this file.
https://zipkin.io/pages/quickstart
curl -sSL https://zipkin.io/quickstart.sh | bash -s
java -jar zipkin.jar
fallback will trigger when department service doesn't work via hystrix circuit breaker