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 36d12b0  CAMEL-25517: docling-langchain4j-rag keeps its values in 
variables (#108)
36d12b0 is described below

commit 36d12b0ce2c99813b95fcfd4e3115a56deaf3a73
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Oct 10 10:44:42 2026 +0200

    CAMEL-25517: docling-langchain4j-rag keeps its values in variables (#108)
    
    Camel favours variables for the values a route keeps for itself: 
setProperty becomes setVariable,
    ${exchangeProperty.x} becomes ${variable.x}, and the Groovy scripts use 
exchange.getVariable and
    exchange.setVariable.
    
    
    Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
    
    Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
 ai/docling-langchain4j-rag/README.md               |  4 +-
 .../docling-langchain4j-rag.yaml                   | 50 +++++++++++-----------
 ai/docling-langchain4j-rag/metadata.json           |  2 +-
 camel-jbang-example-catalog.json                   |  2 +-
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/ai/docling-langchain4j-rag/README.md 
b/ai/docling-langchain4j-rag/README.md
index ef5b184..4c8f368 100644
--- a/ai/docling-langchain4j-rag/README.md
+++ b/ai/docling-langchain4j-rag/README.md
@@ -62,8 +62,8 @@ Stop the example with `ctrl` + `c` and the services with 
`camel infra stop docli
   component picks it up as the one chat model in the registry.
 - `document-analysis-workflow` is the main route: a `file` consumer on 
`documents` with `include` for the
   supported extensions. The body becomes the file's absolute path, the 
`docling` endpoint with
-  `CONVERT_TO_MARKDOWN` sends it to the Docling service and returns the 
Markdown, which is kept in an
-  exchange property. A `setBody` builds the prompt around it, 
`langchain4j-chat` sends it to the model, a
+  `CONVERT_TO_MARKDOWN` sends it to the Docling service and returns the 
Markdown, which is kept in a
+  variable. A `setBody` builds the prompt around it, `langchain4j-chat` sends 
it to the model, a
   Groovy `script` assembles the report from the answer and the Markdown, and a 
`file` producer writes it to
   `output` under the source name plus `_analysis.md`. A last script deletes 
the source file.
 - `document-qa-api` is `platform-http` on `POST /api/ask`: a script finds the 
newest file in `documents`,
diff --git a/ai/docling-langchain4j-rag/docling-langchain4j-rag.yaml 
b/ai/docling-langchain4j-rag/docling-langchain4j-rag.yaml
index 732ac88..c06c563 100644
--- a/ai/docling-langchain4j-rag/docling-langchain4j-rag.yaml
+++ b/ai/docling-langchain4j-rag/docling-langchain4j-rag.yaml
@@ -25,7 +25,7 @@
       steps:
         - log:
             message: "Processing document: ${header.CamelFileName}"
-        - setProperty:
+        - setVariable:
             name: originalFileName
             expression:
               simple:
@@ -45,12 +45,12 @@
               useDoclingServe: true
         - log:
             message: Document converted to Markdown successfully
-        - setProperty:
+        - setVariable:
             name: sourceFilePath
             expression:
               simple:
-                expression: "${exchangeProperty.originalFileName}"
-        - setProperty:
+                expression: "${variable.originalFileName}"
+        - setVariable:
             name: convertedMarkdown
             expression:
               simple:
@@ -59,7 +59,7 @@
             expression:
               groovy:
                 expression: |
-                  def markdown = exchange.getProperty("convertedMarkdown", 
String.class)
+                  def markdown = exchange.getVariable("convertedMarkdown", 
String.class)
                   def preview = markdown.length() > 500 ? 
markdown.substring(0, 500) + "..." : markdown
                   log.info("Converted Markdown preview:\n{}", preview)
         - setBody:
@@ -72,7 +72,7 @@
                   3. Any important findings or conclusions
 
                   Document content:
-                  ${exchangeProperty.convertedMarkdown}
+                  ${variable.convertedMarkdown}
         - log:
             message: Analyzing document with AI model...
         - to:
@@ -80,7 +80,7 @@
             parameters:
               chatId: analysis
               chatModel: "#chatModel"
-        - setProperty:
+        - setVariable:
             name: aiAnalysis
             expression:
               simple:
@@ -91,9 +91,9 @@
             expression:
               groovy:
                 expression: |
-                  def fileName = exchange.getProperty("originalFileName")
-                  def markdown = exchange.getProperty("convertedMarkdown", 
String.class)
-                  def analysis = exchange.getProperty("aiAnalysis", 
String.class)
+                  def fileName = exchange.getVariable("originalFileName")
+                  def markdown = exchange.getVariable("convertedMarkdown", 
String.class)
+                  def analysis = exchange.getVariable("aiAnalysis", 
String.class)
                   def dateStr = new java.text.SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss").format(new java.util.Date())
 
                   def result = "# Document Analysis Report\n\n" +
@@ -111,7 +111,7 @@
             name: CamelFileName
             expression:
               simple:
-                expression: "${exchangeProperty.originalFileName}_analysis.md"
+                expression: "${variable.originalFileName}_analysis.md"
         - to:
             uri: file
             parameters:
@@ -126,7 +126,7 @@
                   import java.nio.file.Paths
 
                   def docDir = 
camelContext.resolvePropertyPlaceholders("{{documents.directory}}")
-                  def fileName = exchange.getProperty("sourceFilePath")
+                  def fileName = exchange.getVariable("sourceFilePath")
                   def filePath = Paths.get(docDir, fileName)
 
                   if (Files.exists(filePath)) {
@@ -134,7 +134,7 @@
                     log.info("Cleaned up source file: {}", filePath)
                   }
         - log:
-            message: "Processing complete for: 
${exchangeProperty.originalFileName}"
+            message: "Processing complete for: ${variable.originalFileName}"
 - route:
     id: document-qa-api
     from:
@@ -144,7 +144,7 @@
       steps:
         - log:
             message: "Received question: ${body}"
-        - setProperty:
+        - setVariable:
             name: userQuestion
             expression:
               simple:
@@ -168,20 +168,20 @@
 
                     if (latestFile != null) {
                       exchange.message.setBody(latestFile.toFile())
-                      exchange.setProperty("documentFound", true)
+                      exchange.setVariable("documentFound", true)
                     } else {
-                      exchange.setProperty("documentFound", false)
+                      exchange.setVariable("documentFound", false)
                       exchange.message.setBody("No documents found in 
directory")
                     }
                   } else {
-                    exchange.setProperty("documentFound", false)
+                    exchange.setVariable("documentFound", false)
                     exchange.message.setBody("Documents directory does not 
exist")
                   }
         - choice:
             when:
               - expression:
                   simple:
-                    expression: "${exchangeProperty.documentFound} == true"
+                    expression: "${variable.documentFound} == true"
                 steps:
                   - log:
                       message: Converting document for Q&A...
@@ -192,7 +192,7 @@
                         contentInBody: true
                         doclingServeUrl: "{{docling.serve.url}}"
                         useDoclingServe: true
-                  - setProperty:
+                  - setVariable:
                       name: documentContent
                       expression:
                         simple:
@@ -204,9 +204,9 @@
                             You are a helpful assistant answering questions 
about documents.
 
                             Document content:
-                            ${exchangeProperty.documentContent}
+                            ${variable.documentContent}
 
-                            Question: ${exchangeProperty.userQuestion}
+                            Question: ${variable.userQuestion}
 
                             Please provide a clear and concise answer based on 
the document content above.
                   - to:
@@ -267,7 +267,7 @@
             steps:
               - log:
                   message: "Summarizing: ${body}"
-              - setProperty:
+              - setVariable:
                   name: currentFile
                   expression:
                     simple:
@@ -346,7 +346,7 @@
       steps:
         - log:
             message: Extracting structured data from uploaded document
-        - setProperty:
+        - setVariable:
             name: uploadedContent
             expression:
               simple:
@@ -359,7 +359,7 @@
               doclingServeUrl: "{{docling.serve.url}}"
               outputFormat: json
               useDoclingServe: true
-        - setProperty:
+        - setVariable:
             name: structuredData
             expression:
               simple:
@@ -374,7 +374,7 @@
                   3. Any tables or structured information
 
                   Structured data:
-                  ${exchangeProperty.structuredData}
+                  ${variable.structuredData}
         - to:
             uri: langchain4j-chat
             parameters:
diff --git a/ai/docling-langchain4j-rag/metadata.json 
b/ai/docling-langchain4j-rag/metadata.json
index 92b2d1c..12a130b 100644
--- a/ai/docling-langchain4j-rag/metadata.json
+++ b/ai/docling-langchain4j-rag/metadata.json
@@ -15,7 +15,7 @@
             "split",
             "choice",
             "script",
-            "setProperty",
+            "setVariable",
             "setHeader"
         ],
         "languages": [
diff --git a/camel-jbang-example-catalog.json b/camel-jbang-example-catalog.json
index f1fef16..c6e5992 100644
--- a/camel-jbang-example-catalog.json
+++ b/camel-jbang-example-catalog.json
@@ -16,7 +16,7 @@
                 "split",
                 "choice",
                 "script",
-                "setProperty",
+                "setVariable",
                 "setHeader"
             ],
             "languages": [

Reply via email to