我正在尝试找出如何有效配置受hystrix保护的骆驼路由组以引用不同的hystrix线程池
我当前的hystrix配置部分dsl代码(已简化)是(这在每个配置项上都反复出现)
.hystrix()
.id(routeConfig.getRouteId()) //id identifying the hystrix entity
.routeId(routeConfig.getRouteId()) // id identifying the associated camel route
.hystrixConfiguration()
//when not configured,per route hystrix timeout will be null
//in those cases global hystrix configuration will prevail
.executionTimeoutInmilliseconds(routeConfig.getHystrixTimeout())
.end()
.setHeader(HEADER_ROUTE_TYPE,ExpressionBuilder.simpleExpression(
routeConfig.getRouteType().toString()))
.groupKey("group_"+routeConfig.getHystrixId()) //id that hystrix uses to group IDs
// and as threadPool key,if not otherwise specified (as below)
.threadPoolKey("thPool_"+routeConfig.getHystrixId()) //explicit threadPoolKey ID
.to(routeConfig.getOutgoingEndpoint() + CAMEL_HTTP_PARAMETERS)
.end()
我的示例路由配置为:
- routeId: helloWorld1
incomingEndpoint: /home/endpoint1
outgoingEndpoint: https://remote-host/home/remoteendpoint1
hystrixId: helloWorld1Hystrix
我想在配置中添加一个引用某个线程池的标签,但是我不确定在路由配置中引用这些池之前应在何处以及如何实例化此类池。 目前,基本上我会自动将每条路由分配给专用池,但想法是将其中几个分配给共享的但更大的池。
我还有另一个疑问,使用共享池时是否可以保留路由特定的超时时间?