java Camel HTTPS4调用失败,但CamelHttpResponseCode头显示200
我使用的路由是使用https4组件(camel版本2.14.0)通过HTTP请求资源。死信通道通过将失败的交换路由到日志端点来处理错误,如下所示:
.to("log:backendFailed?level=WARN&showAll=true")
在网关超时(504)的情况下,将抛出一个HttpOperationFailedException
指示错误,并按预期记录交换。因为我设置了showAll=true
,所以exchange的所有头都会被记录,包括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
这里的CamelHttpResponseCode
头不是应该写504吗
共 (0) 个答案