gnodet-bot commented on code in PR #29165:
URL: https://github.com/apache/camel/pull/29165#discussion_r4467113750
##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -153,6 +153,38 @@ public static void setOut(Exchange exchange, Object
payload) {
}
}
+ /**
+ * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange
(id, body, headers, out message, properties
+ * and variables), so it is only unmarshalled when the endpoint has
explicitly enabled exchange transfer via
+ * {@code transferExchange=true}. Otherwise the payload is treated as a
normal message body.
+ */
+ private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object
payload) {
+ return payload instanceof DefaultExchangeHolder
+ && endpoint != null &&
endpoint.getConfiguration().isTransferExchange();
+ }
+
+ /**
+ * @deprecated use {@link #setIn(NettyEndpoint, Exchange,
Object)}. This overload has no endpoint and so
+ * cannot check {@code transferExchange} before
unmarshalling a {@link DefaultExchangeHolder}.
+ * @param exchange the exchange
+ * @param payload the decoded payload
+ */
+ @Deprecated
Review Comment:
⚠️ **Missing `since` and `forRemoval`** — this was requested in the prior
review. Use the full annotation form:
```suggestion
@Deprecated(since = "4.11.0", forRemoval = true)
```
##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -153,6 +153,38 @@ public static void setOut(Exchange exchange, Object
payload) {
}
}
+ /**
+ * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange
(id, body, headers, out message, properties
+ * and variables), so it is only unmarshalled when the endpoint has
explicitly enabled exchange transfer via
+ * {@code transferExchange=true}. Otherwise the payload is treated as a
normal message body.
+ */
+ private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object
payload) {
+ return payload instanceof DefaultExchangeHolder
+ && endpoint != null &&
endpoint.getConfiguration().isTransferExchange();
+ }
+
+ /**
+ * @deprecated use {@link #setIn(NettyEndpoint, Exchange,
Object)}. This overload has no endpoint and so
+ * cannot check {@code transferExchange} before
unmarshalling a {@link DefaultExchangeHolder}.
+ * @param exchange the exchange
+ * @param payload the decoded payload
+ */
+ @Deprecated
+ public static void setIn(Exchange exchange, Object payload) {
+ setIn(null, exchange, payload);
+ }
+
+ /**
+ * @deprecated use {@link #setOut(NettyEndpoint, Exchange,
Object)}. This overload has no endpoint and so
+ * cannot check {@code transferExchange} before
unmarshalling a {@link DefaultExchangeHolder}.
+ * @param exchange the exchange
+ * @param payload the decoded payload
+ */
+ @Deprecated
Review Comment:
⚠️ Same: add `since` and `forRemoval`:
```suggestion
@Deprecated(since = "4.11.0", forRemoval = true)
```
##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -108,15 +108,15 @@ private static Object getBody(NettyEndpoint endpoint,
Message message) throws In
}
}
- public static void setIn(Exchange exchange, Object payload) {
- if (payload instanceof DefaultExchangeHolder defaultExchangeHolder) {
- unmarshal(exchange, defaultExchangeHolder);
+ public static void setIn(NettyEndpoint endpoint, Exchange exchange, Object
payload) {
Review Comment:
💡 **Missing Javadoc on new public API.** Add at minimum a description and
`@param` tags:
```suggestion
/**
* Sets the inbound message on the given exchange from a Netty payload,
unmarshalling a
* {@link DefaultExchangeHolder} only when {@code
endpoint.getConfiguration().isTransferExchange()} is true.
* When {@code endpoint} is {@code null} or {@code
transferExchange=false}, the payload is set as-is.
*
* @param endpoint the Netty endpoint (may be {@code null}; suppresses
exchange transfer)
* @param exchange the target exchange
* @param payload the decoded Netty payload
*/
public static void setIn(NettyEndpoint endpoint, Exchange exchange,
Object payload) {
```
##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -131,15 +131,15 @@ public static void setIn(Exchange exchange, Object
payload) {
}
}
- public static void setOut(Exchange exchange, Object payload) {
- if (payload instanceof DefaultExchangeHolder defaultExchangeHolder) {
- unmarshal(exchange, defaultExchangeHolder);
+ public static void setOut(NettyEndpoint endpoint, Exchange exchange,
Object payload) {
Review Comment:
💡 **Missing Javadoc on new public API** (same as `setIn`):
```suggestion
/**
* Sets the outbound message on the given exchange from a Netty payload,
unmarshalling a
* {@link DefaultExchangeHolder} only when {@code
endpoint.getConfiguration().isTransferExchange()} is true.
* When {@code endpoint} is {@code null} or {@code
transferExchange=false}, the payload is set as-is.
*
* @param endpoint the Netty endpoint (may be {@code null}; suppresses
exchange transfer)
* @param exchange the target exchange
* @param payload the decoded Netty payload
*/
public static void setOut(NettyEndpoint endpoint, Exchange exchange,
Object payload) {
```
--
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]