I would appreciate some advice about how to access the
HttpOperationFailedException (or any other exception that occurs, anywhere
in the route) and format it appropriately for my application's protocol,
and send it back through MinaConsumer's TCP connection.

I haven't found any example code that would help me, because all of
the error handling example code seems to be meant for InOnly exchanges.
My exchanges are InOut, because I'm using MinaConsumer in sync=true mode.

I don't want any retries.  I just want to take the exception message,
and format it, and send it back.

I have found a trick that works, but I suspect that this trick is anti-
idiomatic, and that there must be a more Camel-appropriate way to do this.

What is the "right" way to do this?

errorHandler(loggingErrorHandler());
from("mina:tcp://[::]:5927?textline=true")
  .intercept(new DelegateProcessor() {
      public void process(Exchange exchange) throws Exception {
          processNext(exchange);
          Throwable exception = exchange.getException();
          if (exception != null) {
              exchange.setException(null);
              exchange.getOut().setBody(formatException(exception));
          }
      }
  })
  . // route continues ...
-- 
View this message in context: 
http://www.nabble.com/HttpProducer%3A-how-to-access-the-body-of-an-error-page--tp20475651s22882p20598121.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to