Search code examples
javanetflix-eurekanetflix-ribbon

How to call Eureka server from external API to use my Service Applications?


I created an Eureka server and two Service Appications that are my Eureka Clients. These applications and Eureka are properly running and register themselves on Eureka.

How can I call the Eureka Server from an external API to call my Service Applications? I tried doing the following, but it didn't work:

http://myeurekaserver/my-service/test

Solution

  • We do something similar using Eureka REST APIs as documented here. The program would have to make the REST call, collect the output of the GET /eureka/v2/apps/appID or GET /eureka/v2/apps and parse it to locate the running service instance(s), and invoke the target instances. This approch should work for any programming language/script that supports REST and/or HTTP invocations. Some of our external systems uses one or more of cURL, Java libraries or Python HTTP client to call Eureka server using these REST APIs to locate the target services. That should work for you.