我有以下路线:
@Override
public void configure() throws Exception {
String overviewRoute = this.routingProperties.getReportingRoute(OverviewtRouteConstants.OVERVIEW);
this.from(overviewRoute).routeId(overviewRoute).threads(1, 100).choice()
.when(this.simple(BODY_GRAPH_NAME + GraphConstants.OVERVIEW_OPEN_LANE + "'"))
.to(this.routingProperties.getReportingRoute(OVERVIEW_OPENLANES_TO))
.when(this.simple(BODY_GRAPH_NAME + GraphConstants.OVERVIEW_BELT_DOWNTIME + "'"))
.to(this.routingProperties.getReportingRoute(OVERVIEW_BELTDOWNTIME_TO))
.when(this.simple(BODY_GRAPH_NAME + GraphConstants.OVERVIEW_LUGGAGE_THROUGHPUT + "'"))
.to(this.routingProperties.getReportingRoute(OVERVIEW_LUGGAGETHROUGHPUT_TO))
.when(this.simple(BODY_GRAPH_NAME + GraphConstants.OVERVIEW_LANE_UTILIZATION + "'"))
.to(this.routingProperties.getReportingRoute(OVERVIEW_LUGGAGETHROUGHPUT_TO))
.when(this.simple(BODY_GRAPH_NAME + GraphConstants.OVERVIEW_LUGGAGE_SCANNED + "'"))
.to(this.routingProperties.getReportingRoute(OVERVIEW_LUGGAGESCANNED_TO));
}
休息服务端点:
import javax.ws.rs.core.Response;
import org.springframework.stereotype.Service;
@Service(SERVICE_NAME)
public class OverviewServicesImpl extends BaseServices implements OverviewServices {
@Override
public Response overview(OverviewSearchDTO dto) {
return this.executeRouting(OverviewtRouteConstants.OVERVIEW, dto);
}
}
语境 :
主路由概述Route是从ws REST端点调用的。其他路由根据when子句调用。
我的前端多次并行调用主路由。
我所看到的:
在“choice”子句中定义的所有路由都被顺序调用(一旦前一个路由完成,将调用下一个路由)。
我想要的是:
我希望必须在一次ws调用完成后立即调用choice子句中定义的路由,而不是在上一次调用完成后立即调用。
我尝试过的是:
Apache 色达
Spring Scope:@Scope(BeanDefinition.SCOPE_PROTOTYPE)
最佳答案
听起来所有.when
子句都返回True,因此它遵循所有选择。我不确定.when
子句中的部分是否为实际比较?我是否想念您如何进行比较以检查消息的一部分以在基于上下文的路由器中进行比较和路由?
关于java - apache Camel 在路由内多线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52005761/