-
Notifications
You must be signed in to change notification settings - Fork 16
Context Propagation
enadim edited this page Nov 14, 2017
·
2 revisions
The context propagation comes with default strategies for Histrix, Zuul, Feign, spring & java executors, http request, jms, stomp.
The default strategies will preserves the execution context within any async call and will propagate this execution context to downstream services using Http Headers, Stomp Headers or Jms message properties.
The context propagation can enable sharing the current zone with down stream services.
@SpringBootApplication
@EnableContextPropagation
public class Application{
...
}ribbon.extensions.propagation.upStreamZone.enabled=true
ribbon.extensions.propagation.upStreamZone.key=upstream-zoneShould set at least the propagation keys (by default it is empty).
ribbon.extensions.propagation.keys[0]=upstream-zone
ribbon.extensions.propagation.keys[1]=favorite-zoneThe propagation can be disabled for all component using
ribbon.extensions.propagation.enabled=falseProgrammatically
@SpringBootApplication
@EnableContextPropagation(
inboundHttpRequest=false,
feign=false,
executor=false,
zuul=false,
hystrix=false,
jms=false,
stomp=false,
public class Application{
...
}Using properties
ribbon.extensions.propagation.inboundHttpRequest.enabled=false
ribbon.extensions.propagation.feign.enabled=false
ribbon.extensions.propagation.executor.enabled=false
ribbon.extensions.propagation.zuul.enabled=false
ribbon.extensions.propagation.hystrix.enabled=false
ribbon.extensions.propagation.jms.enabled=false
ribbon.extensions.propagation.stomp.enabled=falseThe propagation strategy can be configured at component level.
Default strategies are defined at the annotation @EnableContextPropagation itself
Example:
@SpringBootApplication
@EnableContextPropagation(
inboundHttpRequestStrategy=YourCustomInboundHttpRequestStrategy.class,
feignStrategy=YourCustomFeignStrategy.class,
executorStrategy=YourCustomExecutorStrategy.class,
zuulStrategy=YourCustomZuulStrategy.class,
hystrixStrategy=YourCustomHystrixStrategy.class,
jmsStrategy=YourCustomJmsStrategy.class,
stompStrategy=YourCustomStompStrategy.class,
public class Application{
...
}