Andrea Cosentino created CAMEL-25902:
----------------------------------------
Summary: camel-netty - add a muteException consumer option
Key: CAMEL-25902
URL: https://issues.apache.org/jira/browse/CAMEL-25902
Project: Camel
Issue Type: Improvement
Components: camel-netty
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.24.0, 4.22.3, 4.18.6
CAMEL-24476, CAMEL-24477, CAMEL-24478, CAMEL-25087 and CAMEL-25460 added a
{{muteException}} consumer option to camel-mina, camel-cxf, camel-grpc,
camel-coap and camel-thrift, defaulting to {{true}} in line with the http
family after CAMEL-23651. The plain camel-netty consumer (TCP/UDP) has no such
option.
When the exchange failed and {{transferExchange}} is off,
{{ServerChannelHandler.getResponseBody}} uses the route's exception as the
reply:
{code:java}
boolean exception = exchange.getException() != null &&
!consumer.getEndpoint().getConfiguration().isTransferExchange();
if (exception) {
return exchange.getException();
}
{code}
With {{textline=true}} the reply is the exception converted to a String, i.e.
its class name and message
({{NettyTcpWithInOutUsingPlainSocketTest.testExchangeFailedOutShouldBeNull}}
asserts this). With an encoder that accepts any object, it is the serialised
exception.
Proposal: add a {{muteException}} consumer option to {{NettyConfiguration}},
defaulting to {{true}}, that replies with a generic exception carrying no class
name, message or stack trace (as camel-mina does), with an upgrade-guide entry
noting that routes relying on the detail must set it to {{false}}.
{{NettyHttpConfiguration}} already declares {{muteException}}; move it up to
{{NettyConfiguration}} rather than declaring it twice.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)