davsclaus commented on code in PR #28635:
URL: https://github.com/apache/camel/pull/28635#discussion_r4408919128


##########
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:
   Fixed in 04cc435e52ce.
   
   _Claude Code on behalf of davsclaus_



##########
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:
   Fixed in 04cc435e52ce.
   
   _Claude Code on behalf of davsclaus_



##########
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:
   Fixed in 04cc435e52ce.
   
   _Claude Code on behalf of davsclaus_



##########
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:
   Fixed in 04cc435e52ce.
   
   _Claude Code on behalf of davsclaus_



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