skin27 opened a new issue, #2771:
URL: https://github.com/apache/camel-kamelets/issues/2771

   I try to run the Counter Kamelet:
   
   
https://github.com/apache/camel-kamelets/blob/main/kamelets/counter-source.kamelet.yaml
   
   This Kamelet defines a bean: 
   
   ```yaml
   apiVersion: camel.apache.org/v1
   
   kind: Kamelet
   
   metadata:
   
     name: counter-source
   
     labels:
   
       camel.apache.org/kamelet.type: "source"
   
   spec:
   
     definition:
   
       title: "Counter Source"
   
       description: "Generates sequential number events starting from a 
configurable value, incrementing by a specified step. Useful for testing, 
scheduled tasks, or creating ordered event sequences."
   
       type: object
   
       properties:
   
         period:
   
           title: Period
   
           description: The time interval between two numbers
   
           type: integer
   
           default: 1000
   
         start:
   
           title: Starting Number
   
           description: The starting number
   
           type: integer
   
           default: 1
   
         numbers:
   
           title: Numbers
   
           description: How many numbers to generate
   
           type: integer
   
         in:
   
           title: "Source Endpoint"
   
           type: "string"
   
           default: "kamelet:source"
   
         out:
   
           title: "Sink Endpoint"
   
           type: "string"
   
           default: "kamelet:sink"
   
         routeId:
   
           title: "Route ID"
   
           type: "string"
   
         routeConfigurationId:
   
           title: "Route Configuration ID"
   
           type: "string"
   
           default: "0"
   
     dependencies:
   
       - "camel:timer"
   
       - "camel:core"
   
       - "camel:bean"
   
       - "camel:kamelet"
   
     template:
   
       beans:
   
         - name: counter
   
           type: java.util.concurrent.atomic.AtomicInteger
   
           constructors:
   
             "0": "{{start}}"
   
       route:
   
         routeConfigurationId: "{{routeConfigurationId}}"
   
         from:
   
           uri: "timer:counter"
   
           parameters:
   
             period: "{{period}}"
   
             repeatCount: "{{?numbers}}"
   
           steps:
   
             - bean:
   
                 ref: "{{counter}}"
   
                 method: getAndIncrement
   
             - setHeader:
   
                 name: "Content-Type"
   
                 constant: "text/plain"
   
             - to: "{{out}}"
   ```
   
   When running it with {{counter}}  I get:
   
   `Property with key [counter] not found in properties from text: {{counter}}`
   
   I also tried with a few other syntax such as:
   
   ```
             - bean:
   
                 ref: "counter"
   
                 method: getAndIncrement
   ```
   
   or
   
   ```
   steps:
             - to: "bean:counter?method=getAndIncrement"
   ```
   
   However, in those cases I get:
   
   `No bean could be found in the registry for: counter`
   
   
   Note: It seems that when the bean is defined within the Kamelet it's not 
registered/in scope of the registry. I am using a SimpleRegistry:
   
   `private final SimpleRegistry registry = new SimpleRegistry();`
   
   When I define beans globally/programmatically it works fine (camel-bean is 
on my classpath).
   
   
   
   
   What is the correct syntax?


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