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-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 9d113fa  Polished
9d113fa is described below

commit 9d113fa96739fac0ac4b80ebd10cbd66eabf06b4
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 5 09:56:56 2026 +0100

    Polished
---
 jbang/simple-custom-function/StockFunction.java |  5 +++--
 jbang/simple-custom-function/myapp.camel.yaml   | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/jbang/simple-custom-function/StockFunction.java 
b/jbang/simple-custom-function/StockFunction.java
index c2e32a8..fdc977d 100644
--- a/jbang/simple-custom-function/StockFunction.java
+++ b/jbang/simple-custom-function/StockFunction.java
@@ -16,12 +16,13 @@ public class StockFunction implements SimpleFunction {
 
        @Override
        public boolean allowNull() {
-               return true;
+               return true; // true = functions that does not accept any input 
parameter
        }
 
        @Override
        public Object apply(Exchange exchange, Object input) throws Exception {
-               return 200 + new Random().nextInt(1000);
+               String name = input == null ? "SP500" : "" + input;
+               return name + " at $" + (200 + new Random().nextInt(1000));
        }
 
 }
\ No newline at end of file
diff --git a/jbang/simple-custom-function/myapp.camel.yaml 
b/jbang/simple-custom-function/myapp.camel.yaml
index ff3af7e..297a227 100644
--- a/jbang/simple-custom-function/myapp.camel.yaml
+++ b/jbang/simple-custom-function/myapp.camel.yaml
@@ -1,8 +1,16 @@
 - from:
-    uri: "timer:yaml"
+    uri: "timer:stock"
     parameters:
-      period: "5000"
+      period: 5000
     steps:
-      - setBody:
-          simple: ${stock}
-      - log: "The stock price is: ${body}"
+      - log: |
+
+
+          Stock prices today
+
+          ${stock()}
+          ${stock('AAPL')}
+          ${stock('IBM')}
+
+          Have a nice day
+        
\ No newline at end of file

Reply via email to