Currently, I am working on a POC in my organization. Our goal is to implement Service Discovery. For that reason, I was exploring Eureka. Eureka is pretty great for service discovery without any conditions. Our requirement is to implement conditional service discovery.
Our current implementation:
This is a straight-forward implementation where we have multiple clients consuming services exposed by a single micro-service Service-A.
As we are planning to introduce a new micro-service Service-B with the same contract as Service-A. With this new service, clients will have to implement logic to identify which service to call based on some parameters. Each client will have to implement this logic:
This is where Service Discovery comes in. I was trying out Eureka, but I couldn't find any document or resource which indicated that we can have custom logic for service registry or service discovery. I am not even sure if what I want to do is possible with Eureka. This is our goal:
We want to use Service discovery as we might add few more such services based on new types. What I tried was to have my own RestController which will then call internal methods of ApplicationResource. That did not work. I couldn't find any interface/abstract class that I can implement/extend to change the logic.
*Pardon my bad drawing skills.