gnodet-bot commented on code in PR #28635:
URL: https://github.com/apache/camel/pull/28635#discussion_r4406408909


##########
catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc:
##########
@@ -51,6 +51,72 @@ Enrich EIP is the most common content enricher that uses a 
`Producer` to obtain
 The content enricher (`enrich`) retrieves additional data from a _resource 
endpoint_
 to enrich an incoming message (contained in the _original exchange_).
 
+=== Keeping the message: the reply in a variable
+
+By default, the reply of the resource endpoint becomes the message, as with 
`to`: the reply body replaces the body.
+To keep the message as it is, set `variableReceive`: the reply body is stored 
in that variable, and the message body
+and headers stay unchanged. This is the simplest way to enrich, with no 
aggregation strategy to write.
+
+For example, the body is an order that is sent to the stock service with 
request-reply, and the order stays the body,
+so it can be sent on after the stock service has answered:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("jms:queue:orders")
+  .enrich().constant("jms:queue:stock").variableReceive("stock")
+  .log("Stock service answered for ${header.orderId}: ${variable.stock}")
+  .to("jms:queue:reserved");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="jms:queue:orders"/>
+  <enrich variableReceive="stock">
+    <constant>jms:queue:stock</constant>
+  </enrich>
+  <log message="Stock service answered for ${header.orderId}: 
${variable.stock}"/>
+  <to uri="jms:queue:reserved"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: jms:queue:orders
+      steps:
+        - enrich:
+            expression:
+              constant:
+                expression: jms:queue:stock

Review Comment:
   💡 **Nit — expression syntax inconsistency:** The existing YAML examples in 
this file use the shorthand form (`expression: constant: http:...`), but this 
new block uses the explicit nested form. Both are valid, but mixing them in the 
same file is inconsistent. Suggest using the shorthand for consistency:
   
   ```suggestion
                 constant: jms:queue:stock
   ```



##########
catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc:
##########
@@ -51,6 +51,72 @@ Enrich EIP is the most common content enricher that uses a 
`Producer` to obtain
 The content enricher (`enrich`) retrieves additional data from a _resource 
endpoint_
 to enrich an incoming message (contained in the _original exchange_).
 
+=== Keeping the message: the reply in a variable
+
+By default, the reply of the resource endpoint becomes the message, as with 
`to`: the reply body replaces the body.
+To keep the message as it is, set `variableReceive`: the reply body is stored 
in that variable, and the message body
+and headers stay unchanged. This is the simplest way to enrich, with no 
aggregation strategy to write.
+
+For example, the body is an order that is sent to the stock service with 
request-reply, and the order stays the body,
+so it can be sent on after the stock service has answered:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("jms:queue:orders")
+  .enrich().constant("jms:queue:stock").variableReceive("stock")
+  .log("Stock service answered for ${header.orderId}: ${variable.stock}")
+  .to("jms:queue:reserved");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="jms:queue:orders"/>
+  <enrich variableReceive="stock">
+    <constant>jms:queue:stock</constant>
+  </enrich>
+  <log message="Stock service answered for ${header.orderId}: 
${variable.stock}"/>
+  <to uri="jms:queue:reserved"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: jms:queue:orders
+      steps:
+        - enrich:
+            expression:
+              constant:
+                expression: jms:queue:stock
+            variableReceive: stock
+        - log:
+            message: "Stock service answered for ${header.orderId}: 
${variable.stock}"
+        - to:
+            uri: jms:queue:reserved
+----
+====
+
+The headers of the reply are stored as variables too, named `header:stock.` 
and the name of the header, such as
+`header:stock.JMSCorrelationID`. To send something other than the message body 
to the resource endpoint,

Review Comment:
   💡 **Nit — confusing wording:** The phrase `header:stock.` (with trailing dot 
inside the backtick span) looks like a complete but malformed variable name. It 
reads awkwardly — suggest explaining the pattern more clearly:
   
   ```suggestion
   The headers of the reply are stored as variables too, using the pattern 
`header:<variable>.<headerName>`, for example
   `header:stock.JMSCorrelationID`. To send something other than the message 
body to the resource endpoint,
   ```



##########
core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc:
##########
@@ -51,6 +51,72 @@ Enrich EIP is the most common content enricher that uses a 
`Producer` to obtain
 The content enricher (`enrich`) retrieves additional data from a _resource 
endpoint_
 to enrich an incoming message (contained in the _original exchange_).
 
+=== Keeping the message: the reply in a variable
+
+By default, the reply of the resource endpoint becomes the message, as with 
`to`: the reply body replaces the body.
+To keep the message as it is, set `variableReceive`: the reply body is stored 
in that variable, and the message body
+and headers stay unchanged. This is the simplest way to enrich, with no 
aggregation strategy to write.
+
+For example, the body is an order that is sent to the stock service with 
request-reply, and the order stays the body,
+so it can be sent on after the stock service has answered:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("jms:queue:orders")
+  .enrich().constant("jms:queue:stock").variableReceive("stock")
+  .log("Stock service answered for ${header.orderId}: ${variable.stock}")
+  .to("jms:queue:reserved");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="jms:queue:orders"/>
+  <enrich variableReceive="stock">
+    <constant>jms:queue:stock</constant>
+  </enrich>
+  <log message="Stock service answered for ${header.orderId}: 
${variable.stock}"/>
+  <to uri="jms:queue:reserved"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: jms:queue:orders
+      steps:
+        - enrich:
+            expression:
+              constant:
+                expression: jms:queue:stock

Review Comment:
   💡 **Nit — expression syntax inconsistency:** Same as the catalog copy — 
existing YAML examples use the shorthand form (`expression: constant: 
http:...`). Suggest:
   
   ```suggestion
                 constant: jms:queue:stock
   ```



##########
core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc:
##########
@@ -51,6 +51,72 @@ Enrich EIP is the most common content enricher that uses a 
`Producer` to obtain
 The content enricher (`enrich`) retrieves additional data from a _resource 
endpoint_
 to enrich an incoming message (contained in the _original exchange_).
 
+=== Keeping the message: the reply in a variable
+
+By default, the reply of the resource endpoint becomes the message, as with 
`to`: the reply body replaces the body.
+To keep the message as it is, set `variableReceive`: the reply body is stored 
in that variable, and the message body
+and headers stay unchanged. This is the simplest way to enrich, with no 
aggregation strategy to write.
+
+For example, the body is an order that is sent to the stock service with 
request-reply, and the order stays the body,
+so it can be sent on after the stock service has answered:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("jms:queue:orders")
+  .enrich().constant("jms:queue:stock").variableReceive("stock")
+  .log("Stock service answered for ${header.orderId}: ${variable.stock}")
+  .to("jms:queue:reserved");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="jms:queue:orders"/>
+  <enrich variableReceive="stock">
+    <constant>jms:queue:stock</constant>
+  </enrich>
+  <log message="Stock service answered for ${header.orderId}: 
${variable.stock}"/>
+  <to uri="jms:queue:reserved"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: jms:queue:orders
+      steps:
+        - enrich:
+            expression:
+              constant:
+                expression: jms:queue:stock
+            variableReceive: stock
+        - log:
+            message: "Stock service answered for ${header.orderId}: 
${variable.stock}"
+        - to:
+            uri: jms:queue:reserved
+----
+====
+
+The headers of the reply are stored as variables too, named `header:stock.` 
and the name of the header, such as
+`header:stock.JMSCorrelationID`. To send something other than the message body 
to the resource endpoint,

Review Comment:
   💡 **Nit — confusing wording:** Same as the catalog copy.
   
   ```suggestion
   The headers of the reply are stored as variables too, using the pattern 
`header:<variable>.<headerName>`, for example
   `header:stock.JMSCorrelationID`. To send something other than the message 
body to the resource endpoint,
   ```



-- 
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]

Reply via email to