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.git
The following commit(s) were added to refs/heads/main by this push:
new 586855a18315 chore: camel-jbang - sync the bundled examples: values
kept in variables
586855a18315 is described below
commit 586855a1831530479efacd0f0c7d0cb065346cff
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Oct 10 11:02:06 2026 +0200
chore: camel-jbang - sync the bundled examples: values kept in variables
Synced with the sync-example-catalog profile after
apache/camel-jbang-examples#104, #105 and #106
(CAMEL-25517): http-client, openapi-client and openapi-server keep their
values in variables
(setVariable, ${variable.x}) instead of exchange properties, and their
READMEs say so.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
---
.../examples/camel-jbang-example-catalog.json | 10 +++++-----
.../resources/examples/connect/http-client/README.md | 10 +++++-----
.../connect/http-client/http-client.camel.yaml | 18 +++++++++---------
.../examples/contracts/openapi-client/README.md | 4 ++--
.../contracts/openapi-client/openapi-client.camel.yaml | 10 +++++-----
.../contracts/openapi-server/openapi-server.camel.yaml | 10 +++++-----
6 files changed, 31 insertions(+), 31 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-jbang-example-catalog.json
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-jbang-example-catalog.json
index 4c5c0274f615..c6e5992fc930 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-jbang-example-catalog.json
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-jbang-example-catalog.json
@@ -16,7 +16,7 @@
"split",
"choice",
"script",
- "setProperty",
+ "setVariable",
"setHeader"
],
"languages": [
@@ -59,7 +59,7 @@
],
"eips": [
"setBody",
- "setProperty",
+ "setVariable",
"unmarshal"
],
"languages": [
@@ -540,7 +540,7 @@
],
"eips": [
"split",
- "setProperty",
+ "setVariable",
"toD",
"choice",
"unmarshal",
@@ -674,7 +674,7 @@
"eips": [
"split",
"onException",
- "setProperty",
+ "setVariable",
"setHeader",
"unmarshal"
],
@@ -726,7 +726,7 @@
"onException",
"marshal",
"unmarshal",
- "setProperty"
+ "setVariable"
],
"languages": [
"simple",
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/README.md
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/README.md
index f03565365e6f..63df4c891777 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/README.md
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/README.md
@@ -32,12 +32,12 @@ repeated. The stock levels are in `stock.json`.
## How it works
- The client splits each order into lines, as `order-lines` does, and calls
`toD` with
- `http://localhost:8080/stock/${exchangeProperty.sku}`: `toD` because the URI
is built per message.
-- The SKU, the quantity and the order id are kept in exchange properties, not
headers: headers travel on the
+ `http://localhost:8080/stock/${variable.sku}`: `toD` because the URI is
built per message.
+- The SKU, the quantity and the order id are kept in variables, not headers:
headers travel on the
HTTP request, and a header named `sku` would collide with the `{sku}` path
parameter on the server side.
- Properties stay in the route.
+ Variables stay in the route.
- The body is set to null before the call: a GET has no body, and the order
line would otherwise be sent. The
- response replaces the body, which is why the line was saved in properties
first.
+ response replaces the body, which is why the line was saved in variables
first.
- `throwExceptionOnFailure=false` turns a 404 into a normal response with
`CamelHttpResponseCode` set, so the
`choice` can log it instead of the error handler.
@@ -45,7 +45,7 @@ repeated. The stock levels are in `stock.json`.
1. Start from `stock-api` and add a `file` route on `orders` that logs each
order.
2. Split the lines and call `http://localhost:8080/stock/CAMEL-MUG` with a
fixed SKU; log the response body.
-3. Build the URI from the line with `toD` and a property; notice the body is
gone after the call.
+3. Build the URI from the line with `toD` and a variable; notice the body is
gone after the call.
4. Add `throwExceptionOnFailure=false` and the `choice` on the response code
and the quantity.
## Try changing
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/http-client.camel.yaml
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/http-client.camel.yaml
index a73f67e54f97..0b342e0874b1 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/http-client.camel.yaml
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/connect/http-client/http-client.camel.yaml
@@ -65,8 +65,8 @@
- unmarshal:
json:
library: Jackson
- # exchange properties stay in the route; headers would travel on the
HTTP request
- - setProperty:
+ # variables stay in the route; headers would travel on the HTTP request
+ - setVariable:
name: orderId
expression:
simple:
@@ -76,12 +76,12 @@
simple:
expression: "${body[lines]}"
steps:
- - setProperty:
+ - setVariable:
name: sku
expression:
simple:
expression: "${body[sku]}"
- - setProperty:
+ - setVariable:
name: needed
expression:
simple:
@@ -92,7 +92,7 @@
simple:
expression: "${null}"
- toD:
- uri:
"http://localhost:8080/stock/${exchangeProperty.sku}?throwExceptionOnFailure=false"
+ uri:
"http://localhost:8080/stock/${variable.sku}?throwExceptionOnFailure=false"
- unmarshal:
json:
library: Jackson
@@ -103,14 +103,14 @@
expression: "${header.CamelHttpResponseCode} != 200"
steps:
- log:
- message: "${exchangeProperty.orderId}:
${body[error]} (HTTP ${header.CamelHttpResponseCode})"
+ message: "${variable.orderId}: ${body[error]}
(HTTP ${header.CamelHttpResponseCode})"
- expression:
simple:
- expression: "${body[qty]} >=
${exchangeProperty.needed}"
+ expression: "${body[qty]} >= ${variable.needed}"
steps:
- log:
- message: "${exchangeProperty.orderId}:
${exchangeProperty.sku} x ${exchangeProperty.needed}, ${body[qty]} in stock, ok"
+ message: "${variable.orderId}: ${variable.sku} x
${variable.needed}, ${body[qty]} in stock, ok"
otherwise:
steps:
- log:
- message: "${exchangeProperty.orderId}:
${exchangeProperty.sku} x ${exchangeProperty.needed}, only ${body[qty]} in
stock, back-order"
+ message: "${variable.orderId}: ${variable.sku} x
${variable.needed}, only ${body[qty]} in stock, back-order"
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
index 5290ffeda488..51b2c0958f81 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/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/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/openapi-client.camel.yaml
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/openapi-client.camel.yaml
index f45644fce446..dace13a2e6e8 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/openapi-client.camel.yaml
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/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"
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-server/openapi-server.camel.yaml
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-server/openapi-server.camel.yaml
index d2f497b6ceb1..894c6b271715 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-server/openapi-server.camel.yaml
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-server/openapi-server.camel.yaml
@@ -83,7 +83,7 @@
expression:
simple:
expression: "${body[orderId]} != null && ${body[qty]} > 0"
- - setProperty:
+ - setVariable:
name: reservation
expression:
simple:
@@ -107,7 +107,7 @@
expression: '{"error": "unknown sku ${header.sku}"}'
- expression:
simple:
- expression: "${body[qty]} <
${exchangeProperty.reservation[qty]}"
+ expression: "${body[qty]} < ${variable.reservation[qty]}"
steps:
- setHeader:
name: CamelHttpResponseCode
@@ -117,15 +117,15 @@
- setBody:
expression:
simple:
- expression: '{"error": "only ${body[qty]}
${header.sku} in stock, ${exchangeProperty.reservation[qty]} wanted for
${exchangeProperty.reservation[orderId]}"}'
+ expression: '{"error": "only ${body[qty]}
${header.sku} in stock, ${variable.reservation[qty]} wanted for
${variable.reservation[orderId]}"}'
otherwise:
steps:
- log:
- message: "Reserved ${exchangeProperty.reservation[qty]} x
${header.sku} for ${exchangeProperty.reservation[orderId]}"
+ message: "Reserved ${variable.reservation[qty]} x
${header.sku} for ${variable.reservation[orderId]}"
- setBody:
expression:
simple:
- expression: '{"sku": "${header.sku}", "reserved":
${exchangeProperty.reservation[qty]}, "remaining": ${body[qty]}}'
+ expression: '{"sku": "${header.sku}", "reserved":
${variable.reservation[qty]}, "remaining": ${body[qty]}}'
# Finds one SKU in the stock file: the item as a map, or null
- route: