This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-jbang-examples.git
The following commit(s) were added to refs/heads/main by this push:
new deec8e2 CAMEL-25517: openapi-client keeps the order id and sku in
variables (#105)
deec8e2 is described below
commit deec8e2d4417fc7d250f5b4285ec156ef3cefeb5
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Oct 10 10:44:04 2026 +0200
CAMEL-25517: openapi-client keeps the order id and sku in variables (#105)
Camel favours variables for the values a route keeps for itself. The sku
header for the {sku} path
parameter stays a header.
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
camel-jbang-example-catalog.json | 2 +-
contracts/openapi-client/README.md | 4 ++--
contracts/openapi-client/metadata.json | 2 +-
contracts/openapi-client/openapi-client.camel.yaml | 10 +++++-----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/camel-jbang-example-catalog.json b/camel-jbang-example-catalog.json
index e6106cf..fbb847c 100644
--- a/camel-jbang-example-catalog.json
+++ b/camel-jbang-example-catalog.json
@@ -674,7 +674,7 @@
"eips": [
"split",
"onException",
- "setProperty",
+ "setVariable",
"setHeader",
"unmarshal"
],
diff --git a/contracts/openapi-client/README.md
b/contracts/openapi-client/README.md
index 5290ffe..51b2c09 100644
--- a/contracts/openapi-client/README.md
+++ b/contracts/openapi-client/README.md
@@ -48,7 +48,7 @@ can be repeated. `stock.api.url` in `application.properties`
says where the serv
`application.properties`): a call without a value for a path parameter, a
required header or query parameter,
or a required body is refused before it is sent, with a message that names
what is missing, instead of going out
with `{sku}` in the path.
-- The order id and SKU are also kept in exchange properties for the log, since
the response replaces the body
+- The order id and SKU are also kept in variables for the log, since the
response replaces the body
and headers are sent on the wire, as the `http-client` example explains.
- A 409 or 400 from the server is an `HttpOperationFailedException`; the
`onException` logs its status code
and response body and continues with the next line.
@@ -57,7 +57,7 @@ can be repeated. `stock.api.url` in `application.properties`
says where the serv
1. A timer route that calls `rest-openapi` with `operationId: getStock` and a
fixed `sku` header; log the body.
2. Read the orders, split the lines, and call `reserveStock` with the
reservation as the body.
-3. Keep the order id and SKU in properties and log the result.
+3. Keep the order id and SKU in variables and log the result.
4. Add the `onException` and see the cap's 409 handled instead of failing the
order.
## Try changing
diff --git a/contracts/openapi-client/metadata.json
b/contracts/openapi-client/metadata.json
index 6db839f..588b520 100644
--- a/contracts/openapi-client/metadata.json
+++ b/contracts/openapi-client/metadata.json
@@ -13,7 +13,7 @@
"eips": [
"split",
"onException",
- "setProperty",
+ "setVariable",
"setHeader",
"unmarshal"
],
diff --git a/contracts/openapi-client/openapi-client.camel.yaml
b/contracts/openapi-client/openapi-client.camel.yaml
index f45644f..dace13a 100644
--- a/contracts/openapi-client/openapi-client.camel.yaml
+++ b/contracts/openapi-client/openapi-client.camel.yaml
@@ -11,7 +11,7 @@
steps:
- log:
loggingLevel: WARN
- message: "${exchangeProperty.orderId}: ${exchangeProperty.sku} not
reserved, the stock API answered ${exception.statusCode}:
${exception.responseBody}"
+ message: "${variable.orderId}: ${variable.sku} not reserved, the
stock API answered ${exception.statusCode}: ${exception.responseBody}"
- route:
id: reserve-order-lines
@@ -25,7 +25,7 @@
- unmarshal:
json:
library: Jackson
- - setProperty:
+ - setVariable:
name: orderId
expression:
simple:
@@ -35,7 +35,7 @@
simple:
expression: "${body[lines]}"
steps:
- - setProperty:
+ - setVariable:
name: sku
expression:
simple:
@@ -49,7 +49,7 @@
- setBody:
expression:
simple:
- expression: '{"orderId": "${exchangeProperty.orderId}",
"qty": ${body[qty]}}'
+ expression: '{"orderId": "${variable.orderId}", "qty":
${body[qty]}}'
- to:
uri: rest-openapi
parameters:
@@ -61,4 +61,4 @@
json:
library: Jackson
- log:
- message: "${exchangeProperty.orderId}: reserved
${body[reserved]} x ${body[sku]}, ${body[remaining]} left on the shelf"
+ message: "${variable.orderId}: reserved ${body[reserved]} x
${body[sku]}, ${body[remaining]} left on the shelf"