我正在使用使用 https4 组件(camel 版本 2.14.0)通过 HTTP 请求资源的路由。死信通道通过将失败的交换路由到日志端点来处理错误,如下所示:
.to("log:backendFailed?level=WARN&showAll=true")
在网关超时 (504) 的情况下,将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
标题不应该在CamelHttpResponseCode
这里说 504 吗?