Question

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). The to route will respond me with an error page. 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}");
Was it helpful?

Solution

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.

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? From the Camel doc:

Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top