Commit b4679b05 by Nepxion

增加Hystrix逻辑

parent 8292f190
...@@ -73,6 +73,12 @@ public class ARestImpl extends AbstractRestImpl { ...@@ -73,6 +73,12 @@ public class ARestImpl extends AbstractRestImpl {
@RequestMapping(path = "/test", method = RequestMethod.POST) @RequestMapping(path = "/test", method = RequestMethod.POST)
public String test(@RequestBody String value) { public String test(@RequestBody String value) {
try {
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
}
return value; return value;
} }
......
...@@ -22,4 +22,5 @@ management.server.port=5400 ...@@ -22,4 +22,5 @@ management.server.port=5400
# Zuul config # Zuul config
zuul.routes.discovery-springcloud-example-a.path=/discovery-springcloud-example-a/** zuul.routes.discovery-springcloud-example-a.path=/discovery-springcloud-example-a/**
zuul.routes.discovery-springcloud-example-a.serviceId=discovery-springcloud-example-a zuul.routes.discovery-springcloud-example-a.serviceId=discovery-springcloud-example-a
\ No newline at end of file # zuul.ribbon-isolation-strategy=thread
\ No newline at end of file
...@@ -76,5 +76,4 @@ spring.boot.admin.client.url=http://localhost:5555 ...@@ -76,5 +76,4 @@ spring.boot.admin.client.url=http://localhost:5555
# 路由策略过滤器的执行顺序(Order)。缺失则默认为0 # 路由策略过滤器的执行顺序(Order)。缺失则默认为0
# spring.application.strategy.zuul.route.filter.order=0 # spring.application.strategy.zuul.route.filter.order=0
# 开启Zuul网关上实现Hystrix线程隔离模式做服务隔离时,必须把spring.application.strategy.hystrix.threadlocal.supported设置为true,同时要引入discovery-plugin-strategy-starter-hystrix包,否则线程切换时会发生ThreadLocal上下文对象丢失 # 开启Zuul网关上实现Hystrix线程隔离模式做服务隔离时,必须把spring.application.strategy.hystrix.threadlocal.supported设置为true,同时要引入discovery-plugin-strategy-starter-hystrix包,否则线程切换时会发生ThreadLocal上下文对象丢失
# zuul.ribbon-isolation-strategy=thread
# spring.application.strategy.hystrix.threadlocal.supported=true # spring.application.strategy.hystrix.threadlocal.supported=true
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment