Andrea Cosentino created CAMEL-26587:
----------------------------------------
Summary: camel-netty: NettyPayloadHelper should check
transferExchange before processing transferred exchange objects
Key: CAMEL-26587
URL: https://issues.apache.org/jira/browse/CAMEL-26587
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
h3. Current behaviour
In {{camel-netty}}, {{NettyPayloadHelper.setIn}} and {{setOut}} reconstruct
exchange data whenever an incoming payload is an exchange transfer object,
without checking whether {{transferExchange=true}} is enabled on the endpoint
configuration.
h3. Expected behaviour
{{NettyPayloadHelper.setIn}} and {{setOut}} should only reconstruct transferred
exchange state when {{transferExchange=true}} is enabled on the endpoint,
mirroring the behavior of {{camel-mina}}. If {{transferExchange}} is disabled,
the incoming object should be treated as a standard message body without
replacing the exchange headers or properties.
h3. Change
* In {{org.apache.camel.component.netty.NettyPayloadHelper}}:
- Add endpoint-aware overloads {{setIn(NettyEndpoint endpoint, Exchange
exchange, Object payload)}} and {{setOut(NettyEndpoint endpoint, Exchange
exchange, Object payload)}}.
- Only perform exchange reconstruction when the endpoint has
{{transferExchange}} enabled.
- Deprecate the legacy 2-argument {{setIn(Exchange, Object)}} and
{{setOut(Exchange, Object)}} methods.
* Update {{ServerChannelHandler}} and {{ClientChannelHandler}} to pass their
endpoint when setting message payloads.
* Add unit tests in {{camel-netty}} verifying that transferred exchange objects
are treated as ordinary bodies when {{transferExchange}} is false, and
reconstructed when {{transferExchange}} is true.
h3. Tests
* Unit test in {{components/camel-netty}} verifying payload behavior with
{{transferExchange=false}} and {{transferExchange=true}}.
* Ensure all existing tests in {{camel-netty}} continue to pass.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)