简体   繁体   English

骆驼死信频道

[英]Camel Dead Letter channel

I have a route: 我有一条路线:

from("restlet://RestletBean/{id}?restletMethod=GET")
   .setHeader(Exchange.HTTP_METHOD, constant("GET"))
   .setHeader(Exchange.HTTP_URI, simple("http://x.y.z.com?id={header.id}"))
   .to("http://dummyHost")

When I don't give an appropriate input ( id in this case, which is being used as URI parameter in the to route). 当我没有提供适当的输入时(在这种情况下,此idto路由中的URI参数)。 The to route will respond me with an error page. to路线将以错误页面答复我。 Which is not happening. 这没有发生。 Instead there is a blank white page even after handling using dead letter channel error handler: 相反,即使使用死信通道错误处理程序进行处理后,也存在空白的白页:

from("restlet://RestletBean/{id}?restletMethod=GET").
    .setHeader(Exchange.HTTP_METHOD, constant("GET"))
    .setHeader(Exchange.HTTP_URI, simple("http://x.y.z.com?id={header.id}"))
    .to("http://dummyHost")
    .errorHandler("http://x.y.z.com?id={header.id}");

The dead letter channel does not influence the response. 死信通道不会影响响应。 From the Camel doc : 骆驼文档

The Dead Letter Channel will redeliver at most 6 times using 1 second delay, and if the exchange failed it will be logged at ERROR level. 死信通道将使用1秒钟的延迟最多重新传送6次,如果交换失败,它将以ERROR级别记录。

By the way, you didn't properly define a dead letter channel in the error handler. 顺便说一句,您没有在错误处理程序中正确定义一个死信通道。 It should be: 它应该是:

errorHandler(deadLetterChannel("..."))

Did you try to set throwExceptionOnFailure parameter to true ? 您是否尝试将throwExceptionOnFailure参数设置为true From the Camel doc : 骆驼文档

Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. 在远程服务器响应失败的情况下,禁用引发HttpOperationFailedException的选项。 This allows you to get all responses regardless of the HTTP status code. 这样,无论HTTP状态代码如何,您都可以获取所有响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM