0

I have a need to mix calls to a Spring Rest Template using either a Eureka-compliant service name (example-service-name) or a real url (http://my-url.com).

The Eureka-friendly URLs work fine, as Ribbon can look them up without issue. Obviously real URLs fail because they can't be found.

I'd like to be able to integrate Eureka-URLs over time, while maintaining the existing functionality for Spring property-driven direct URLs.

Can I

  1. Configure Ribbon to fall back to a default non-Eureka behavior in the event it fails to resolve a URL ?

or

  1. Spoof Eureka Name/URL pairs in my local Spring configuration and include them in Ribbon's Eureka url resolution ?

Edit: Real URLs are failing because the Ribbon client throws an exception if a Eureka lookup fails

Caused by: java.lang.IllegalStateException: No instances available for http://my-url.com
    at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:75)
JHarnach
  • 3,944
  • 7
  • 43
  • 48

1 Answers1

0

you can regist url as a fake service use this:

my-url:
  ribbon:
    listOfServers: my-url.com
    NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList

and then use http://my-url/xx/xx

fuzi
  • 1