跨 ExecutorChannel 线程的常见超时
Common timeout across ExecutorChannel threads
我们的应用程序集成流程定义为拆分器 -> ws 网关 -> 聚合器。拆分器将请求拆分为帐号列表;因此,对于每个帐号,都会启动一个 Web 服务调用,并且来自多个 Web 服务调用的响应会聚集在拆分器和 ws 网关之间的 aggregator.The 通道中,并使用调度程序 "commonj WorkManagerTaskExecutor" 进行定义,以便每个 Web 服务调用都是在不同线程中并行启动。
我们为每个网络服务调用添加了超时。但是我们想为整个过程设置一个超时。也就是说,所有的网络服务调用都应该在 50 秒内完成,而不是为每个单独的调用设置 50 秒的超时。 commonj WorkManagerTaskExecutor,直接通过代码实现时,通过 waitForAll(Collection workItems, long timeout_ms) 方法提供此功能。有什么方法可以使用这个或类似的功能来实现我们的要求。
很遗憾,不,我们不能使用该特定 TaskExecutor
的自定义功能。
从另一边如果你说 "single timeout for the whole process" 我可以用 <gateway>
模式帮助你:
<chain>
<gateway request-channel="splitterChannel" reply-timeout="50000"/>
</chain>
其中 reply-timeout
是:
Specifies how long this gateway will wait for the reply message
before returning. By default it will wait indefinitely. 'null' is returned
if the gateway times out.
你觉得有意义吗?
我们的应用程序集成流程定义为拆分器 -> ws 网关 -> 聚合器。拆分器将请求拆分为帐号列表;因此,对于每个帐号,都会启动一个 Web 服务调用,并且来自多个 Web 服务调用的响应会聚集在拆分器和 ws 网关之间的 aggregator.The 通道中,并使用调度程序 "commonj WorkManagerTaskExecutor" 进行定义,以便每个 Web 服务调用都是在不同线程中并行启动。
我们为每个网络服务调用添加了超时。但是我们想为整个过程设置一个超时。也就是说,所有的网络服务调用都应该在 50 秒内完成,而不是为每个单独的调用设置 50 秒的超时。 commonj WorkManagerTaskExecutor,直接通过代码实现时,通过 waitForAll(Collection workItems, long timeout_ms) 方法提供此功能。有什么方法可以使用这个或类似的功能来实现我们的要求。
很遗憾,不,我们不能使用该特定 TaskExecutor
的自定义功能。
从另一边如果你说 "single timeout for the whole process" 我可以用 <gateway>
模式帮助你:
<chain>
<gateway request-channel="splitterChannel" reply-timeout="50000"/>
</chain>
其中 reply-timeout
是:
Specifies how long this gateway will wait for the reply message before returning. By default it will wait indefinitely. 'null' is returned if the gateway times out.
你觉得有意义吗?