Camel HTTPS4调用失败,但CamelHttpResponseCode标头显示200

时间:2015-11-23 09:18:15

标签: java apache-camel http-status-code-504

我正在使用通过https4组件(camel版本2.14.0)通过HTTP请求资源的路由。死信通过将失败的交换路由到日志端点来处理错误,如下所示:

MATCH (t:Topic)
WHERE id(t) = 4
RETURN size((t)<-[:DOWNVOTED]-(:Person)) as downvoted,
       size((t)<-[:UPVOTED]-(:Person)) as upvoted,
       size((t)<-[:FLAGGED]-(:Person)) as flagged

如果网关超时(504),则会引发.to("log:backendFailed?level=WARN&showAll=true") ,表示错误,并按预期记录交换。由于我设置了HttpOperationFailedException,因此会记录交换的所有标头,包括showAll=true。日志看起来像这样:

CamelHttpResponseCode

CamelFailureEndpoint=https4://backend?httpClient.socketTimeout=70000&httpClient.connectTimeout=70000, ... CamelToEndpoint=log://backendFailed?level=WARN&showAll=true ... CamelHttpResponseCode=200, CamelHttpUri=https://example.com/myresource, ... CaughtExceptionType: org.apache.camel.component.http4.HttpOperationFailedException, CaughtExceptionMessage: HTTP operation failed invoking https://example.com/myresource with statusCode: 504, StackTrace: org.apache.camel.component.http4.HttpOperationFailedException: HTTP operation failed invoking https://example.com/myresource with statusCode: 504 标题不应该在这里说504?

0 个答案:

没有答案