【问题标题】:WSO2 ESB non-suspend endpoint timeout specifying issueWSO2 ESB 非挂起端点超时指定问题
【发布时间】:2020-08-31 23:56:21
【问题描述】:

我想将非挂起端点的超时持续时间指定为 3000 毫秒(3 秒)。我使用了 WSO2 文档中的配置,并将我的端点文件配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="myEndpointFile" xmlns="http://ws.apache.org/ns/synapse">
<property expression="get-property('endpointAddress')" name="endpointAddress"/>
<address uri="${endpointAddress}">
        <timeout>
           <duration>3000</duration>
           <responseAction>fault</responseAction>
       </timeout>
       <suspendOnFailure>
           <errorCodes>-1</errorCodes>
           <initialDuration>0</initialDuration>
           <progressionFactor>1.0</progressionFactor>
           <maximumDuration>0</maximumDuration>
       </suspendOnFailure>
       <markForSuspension>
           <errorCodes>-1</errorCodes>
       </markForSuspension>
</address>

为了能够对其进行测试,我使用了一个 mocky.io 端点,它的响应延迟为 7000 毫秒(7 秒)http://www.mocky.io/v2/5e7b12732d00008f00119be6?mocky-delay=7000ms

当我尝试调用调用该端点 URL 的 API 时,即使我的超时持续时间为 3000 毫秒(3 秒),我仍然成功 HTTP 200 OK。

这是我在 synapse.properties 中的synapse.global_timeout_interval 参数:

synapse.global_timeout_interval=200000

还有我在 passthru-http.properties 中的 http.socket.timeout 属性值:

http.socket.timeout=180000

版本:WSO2EI6.4.0

感谢您的任何想法!

问候

【问题讨论】:

  • 你如何称呼这个端点?通过呼叫中介阻止模式?还是派调解员?还是别的什么?
  • 嗨@ArunanSugunakumar,我正在通过呼叫调解员打电话。

标签: wso2 wso2esb wso2ei


【解决方案1】:

让我简单解释一下超时处理程序的过程。当我们调用一个端点时,ESB 注册一个回调并且当有一个任务来检查是否超过了超时时间。当任务识别出注册的回调超过了超时时间时,它会移除注册的回调。

您定义的超时值非常小。默认情况下,超时请求的任务每 15 秒运行一次。您可以使用 timeout_handler_interval 参数[1]。

但不建议将其降低到明显较低的值。由于此任务以 15 秒的间隔运行,因此实际超时可能发生在 3 秒(最佳情况)到 3 +15 秒(范围 3s-18 秒)的范围内。

[1]-http://sanjeewamalgoda.blogspot.com/2016/07/how-endpoint-timeouts-and-timeout.html

【讨论】:

  • 感谢您的回复。我现在完全明白了逻辑。
猜你喜欢
  • 1970-01-01
  • 2018-06-14
  • 1970-01-01
  • 2013-07-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多