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


The following commit(s) were added to refs/heads/main by this push:
     new 81be3e8b Add counter kamelet (#2190)
81be3e8b is described below

commit 81be3e8b32c1f99b3cf141f576c0182ce433af80
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Sep 11 10:41:54 2024 +0200

    Add counter kamelet (#2190)
    
    #2189 - Add counter source kamelet
---
 kamelets/counter-source.kamelet.yaml               | 75 ++++++++++++++++++++++
 .../resources/kamelets/counter-source.kamelet.yaml | 74 +++++++++++++++++++++
 2 files changed, 149 insertions(+)

diff --git a/kamelets/counter-source.kamelet.yaml 
b/kamelets/counter-source.kamelet.yaml
new file mode 100644
index 00000000..37e9ba58
--- /dev/null
+++ b/kamelets/counter-source.kamelet.yaml
@@ -0,0 +1,75 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: counter-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.8.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm9
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Timer"
+    camel.apache.org/kamelet.namespace: "Scheduling"
+  labels:
+    camel.apache.org/kamelet.type: source
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: Counter Source
+    description: Counts upwards such as 1,2,3,...
+    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
+  dependencies:
+    - "camel:timer"
+    - "camel:core"
+    - "camel:bean"
+    - "camel:kamelet"
+  template:
+    beans:
+      - name: counter
+        type: java.util.concurrent.atomic.AtomicInteger
+        constructors:
+          "0": "{{start}}"
+    from:
+      uri: timer:counter
+      parameters:
+        period: "{{period}}"
+        repeatCount: "{{?numbers}}"
+      steps:
+        - bean:
+            ref: "{{counter}}"
+            method: getAndIncrement
+        - setHeader:
+            name: "Content-Type"
+            constant: "text/plain"
+        - to: kamelet:sink
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/counter-source.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/counter-source.kamelet.yaml
new file mode 100644
index 00000000..da1330ca
--- /dev/null
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/counter-source.kamelet.yaml
@@ -0,0 +1,74 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: counter-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.8.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm9
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Timer"
+    camel.apache.org/kamelet.namespace: "Scheduling"
+  labels:
+    camel.apache.org/kamelet.type: source
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: Counter
+    description: Counts upwards such as 1,2,3,...
+    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
+  dependencies:
+    - "camel:timer"
+    - "camel:core"
+    - "camel:bean"
+    - "camel:kamelet"
+  template:
+    beans:
+      - name: counter
+        type: java.util.concurrent.atomic.AtomicInteger
+        constructors:
+          "0": "{{start}}"
+    from:
+      uri: timer:counter
+      parameters:
+        period: "{{period}}"
+        repeatCount: "{{?numbers}}"
+      steps:
+        - bean:
+            ref: "{{counter}}"
+            method: getAndIncrement
+        - setHeader:
+            name: "Content-Type"
+            constant: "text/plain"
+        - to: kamelet:sink

Reply via email to