【问题标题】:Apache Camel 2.18.1 http4 component throwing org.apache.http.NoHttpResponseException when throwExceptionOnFailure=falseApache Camel 2.18.1 http4 组件在 throwExceptionOnFailure=false 时抛出 org.apache.http.NoHttpResponseException
【发布时间】:2018-01-10 20:46:12
【问题描述】:

我有一个使用 http4 组件的 Camel 2.18.1 路由,当我在 uri 选项中设置 throwExceptionOnFailure=false 时,该组件偶尔会引发 org.apache.http.NoHttpResponseException 事件。

根据文档:-

如果 throwExceptionOnFailure=false HttpOperationFailedException 将 不会因失败的响应代码而被抛出。这可以让您获得任何 来自远程服务器的响应

我正在使用以下方式设置 http 调用:-

.setHeader(Exchange.HTTP_URI, simple("http://www.therealurl.com"))
.to("http4://dummyhost?throwExceptionOnFailure=false")

在 Java DSL 中,它适用于我为代理等设置的所有其他选项。

有什么想法吗?

【问题讨论】:

  • 你能发布堆栈跟踪吗?也可以尝试更新版本。

标签: apache-camel apache-httpclient-4.x


【解决方案1】:

尝试将您的 url 包含在收件人列表中,例如在 spring DSL 中

<camel:recipientList>
<camel:simple>http4://dummyhost?throwExceptionOnFailure=false</camel:simple>
</camel:recipientList>

【讨论】:

  • 有趣,http4 的 URI 是固定的,因此不需要收件人列表的动态功能。我试试看。
猜你喜欢
  • 2014-10-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多