Skip to content

Dynamic Metadata Matcher

Nadim Benabdenbi edited this page Dec 7, 2017 · 1 revision

Dynamic metadata matcher is designed to target servers with a specific metadata info. It does a round robin balancing when multiple servers have the desired metadata info.

⚠️ If no server has the desired metadata info the routing will fail when matchIfMissing is set to false.

Usage

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

@Configuration
@EnableRibbonStrictMetadataMatcher
public class RibbonClientsConfig {
}

Configuration

Default configuration

ribbon.extensions.rule.strict-metadata-matcher.enabled=true
ribbon.extensions.rule.strict-metadata-matcher.matchIfMissing=true

Customization for a specific ribbon client

ribbon.extensions.client.my-client-name.rule.strict-metadata-matcher.enabled=true
ribbon.extensions.client.my-client-name.rule.strict-metadata-matcher.matchIfMissing=true

Where my-client-name is the ribbon client name

Illustration

Illustration

Illustration

Where current() refers to ExecutionContextHolder.current()