Skip to content

Favorite Zone

Nadim Benabdenbi edited this page Dec 7, 2017 · 2 revisions

The favorite zone predicate is a composite predicate evaluated as follow:

  1. Matches the favorite zone key against the target server zone using the dynamic zone matcher
  2. Matches the current service zone against the target server zone using the zone affinity matcher
  3. Matches the upstream zone key against the target server zone using the dynamic zone matcher
  4. Applies the default ribbon zone avoidance predicate along with the availability predicate
  5. Matches any server

Usage

@RibbonClients(defaultConfiguration = RibbonClientsConfig.class)
@SpringBootApplication
public class Application{
...
}

@Configuration
@EnableRibbonFavoriteZone
public class RibbonClientsConfig {
}

Configuration

Default configuration

ribbon.extensions.rule.favorite-zone.enabled=true
ribbon.extensions.rule.favorite-zone.key=favorite-zone
ribbon.extensions.propagation.upStreamZone.key=upstream-zone

Customization for a specific ribbon client

ribbon.extensions.client.my-client-name.rule.favorite-zone.enabled=true
ribbon.extensions.rule.my-client-name.rule.favorite-zone.key=my-favorite-zone

Where my-client-name is the ribbon client name

Illustration

Illustration

Where current() refers to ExecutionContextHolder.current()