Search code examples
javaarchitecturemicroservicescloud-foundry

Eureka/Discovery Service vs. Routes


In CloudFoundry you can access other microservices by registering them in a discovery service and query them by their name. But you can also setup a route ("subdomain"), from which you can call the service, that seems to be quite easier to handle. In both cases clustering, circuit breaker and such can be used.

In which case should one want to use the first or the second approach?


Solution

  • A registry approach would be preferable when you are concerned about your software's maintainability and resilience.

    A registry name can be meaningful to your software's problem domain, and it can be reused across all deployments of your software (dev, qa, prod, etc.)

    A route name introduces dependencies on your network infrastructure. It must be globally unique, you need to configure and manage a different one for each deployment of your software, and it can break due to external concerns (example: your subdomain changes due to a company name change).