Croway opened a new pull request, #31119: URL: https://github.com/apache/camel/pull/31119
Partial backport of #28985 (CAMEL-26504) to `camel-4.22.x`, requested by a user on the 4.22 LTS. It is not a straight cherry-pick, so it needs a review. Backported, same code as `main`: - camel-netty-http: when `toNettyResponse` throws (for example the body cannot be converted), the consumer answers with HTTP 500 and closes the connection. Before, nothing was written and the client waited. The body is empty unless `muteException=false` (on 4.22.x the netty-http default is `true`). - camel-netty, `transferExchange=true`: `NettyPayloadHelper.getOut` honours `allowSerializedHeaders`, as `getIn` already did, and the headers and exchange properties holding Netty transport objects of the sending side (socket addresses, SSL session, channel, channel handler context) are no longer marshalled. The receiving side already replaces them with its own (CAMEL-26508, in 4.22.3). Not backported: closing the channel in `ServerResponseFutureListener` when the reply write fails. It depends on CAMEL-26136 (#28914), which is not on this branch. Without it, a consumer with the default codec (String encoder only) cannot write a reply that is not a String, nor the exception of a failed exchange. With the close alone, such a consumer drops the connection after each of these replies, and a client that keeps its connection open without reading replies loses the messages it sends next on it. Reproduced on this branch with a raw socket client sending two messages on one connection: today the second message is processed, with the close it is lost. On `main`, CAMEL-26136 converts the reply to a String first, so the close does not fire there. CAMEL-26136 itself changes what clients receive (a failed exchange becomes a successful String reply with the `muteException` text of CAMEL-25902, `useByteBuf` failures, a checked exception on `NettyPayloadHelper.getIn/getOut`), so i t stays on `main`. Differences from #28985: - `ServerResponseFutureListener` and `NettyReplyWriteFailureTest` are not included (see above). - `NettyPayloadHelper.getIn/getOut` keep the 4.22.x body handling and signatures. - The Javadoc of `TRANSPORT_KEYS` no longer says that `ObjectDecoder` has a default deserialization filter: on 4.22.x it installs none unless one is configured. - `NettyTransferExchangeAllowSerializedHeadersTest` passes `DeserializationFilterHelper.DEFAULT_DESERIALIZATION_FILTER` to its decoders, so it checks on this branch what it checks on `main`, where that filter is the default. Tests: - camel-netty (131) and camel-netty-http (305) pass. - Each new test fails without its fix: without the netty-http change the HTTP client times out; without the `getOut` change the serialized reply header is missing; without the stripping the consumer's decoder rejects the `InetSocketAddress` headers of the request and the producer gets no response. Upgrade guide: the 4.22.4 entries go in the 4.22 guide on `main` (separate PR). _Claude Code on behalf of Federico Mariani (Croway)_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
