Created
February 21, 2019 13:50
-
-
Save melardev/ab00c1eee929656c6344bbde5f11e167 to your computer and use it in GitHub Desktop.
Ribbon tutorial melardev.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.melardev.cloud.ribbon.config; | |
import com.netflix.client.config.IClientConfig; | |
import com.netflix.loadbalancer.*; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
public class RibbonConfiguration { | |
@Autowired | |
IClientConfig ribbonClientConfig; | |
@Bean | |
public IPing ribbonPing(IClientConfig config) { | |
return new PingUrl(); | |
// ping the server to get some results, then run rules through the results.¿Which rules? see method below(weigh time) | |
} | |
@Bean | |
public IRule ribbonRule() { | |
return new WeightedResponseTimeRule(); | |
// Measure the response time, select the one with smaller response time. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment