You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/11/30 10:36:33 UTC
[camel-kamelets] 01/09: Add a Google Cloud Storage CDC Source Kamelet
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch 1188
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit a80958b3cce223f536e38f33e2ef2591c22d87c3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 30 11:18:25 2022 +0100
Add a Google Cloud Storage CDC Source Kamelet
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
kamelets/google-storage-cdc-source.kamelet.yaml | 123 ++++++++++++++++++++++++
1 file changed, 123 insertions(+)
diff --git a/kamelets/google-storage-cdc-source.kamelet.yaml b/kamelets/google-storage-cdc-source.kamelet.yaml
new file mode 100644
index 00000000..1e7e48ab
--- /dev/null
+++ b/kamelets/google-storage-cdc-source.kamelet.yaml
@@ -0,0 +1,123 @@
+# ---------------------------------------------------------------------------
+# 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/v1alpha1
+kind: Kamelet
+metadata:
+ name: google-storage-cdc-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "main-SNAPSHOT"
+ camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1MDAiIHZpZXdCb3g9Ii0xLjYzMzIzNTQzIDcuMDMyNjA5MzMgMTMxLjI2NTc0NjgyIDExNC40MzkzOTA2NyIgd2lkdGg9IjI1MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2NCIgeDI9IjY0IiB5MT0iNy4wMzQiIHkyPSIxMjAuNzg5Ij48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM0Mzg3ZmQiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3 [...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Google Storage"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+spec:
+ definition:
+ title: "Google Pubsub Source"
+ description: |-
+ Consume messages from Google Cloud Pub/Sub.
+ required:
+ - projectId
+ - subscriptionName
+ - serviceAccountKey
+ - bucketNameOrArn
+ type: object
+ properties:
+ projectId:
+ title: Project Id
+ description: The Google Cloud Pub/Sub Project ID.
+ type: string
+ subscriptionName:
+ title: Subscription Name
+ description: The subscription name.
+ type: string
+ serviceAccountKey:
+ title: Service Account Key
+ description: The service account key to use as credentials for the Pub/Sub publisher/subscriber. You must encode this value in base64.
+ type: binary
+ x-descriptors:
+ - urn:camel:group:credentials
+ synchronousPull:
+ title: Synchronous Pull
+ description: Specifies to synchronously pull batches of messages.
+ type: boolean
+ x-descriptors:
+ - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+ default: false
+ maxMessagesPerPoll:
+ title: Max Messages Per Poll
+ description: The maximum number of messages to receive from the server in a single API call.
+ type: integer
+ default: 1
+ concurrentConsumers:
+ title: Concurrent Consumers
+ description: The number of parallel streams to consume from the subscription.
+ type: integer
+ default: 1
+ bucketNameOrArn:
+ title: Bucket Name Or ARN
+ description: The Google Cloud Storage bucket name or Bucket Amazon Resource Name (ARN).
+ type: string
+ getObject:
+ title: Get Object in Bucket
+ description: >-
+ If getObject is enabled, then the file created in the Bucket will be
+ get and returned as body, if not only the event will be returned as body.
+ type: boolean
+ x-descriptors:
+ - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+ default: false
+ dependencies:
+ - "camel:kamelet"
+ - "camel:google-pubsub"
+ - "camel:google-storage"
+ - "camel:jackson"
+ template:
+ from:
+ uri: "google-pubsub://{{projectId}}:{{subscriptionName}}"
+ parameters:
+ serviceAccountKey: "base64:{{serviceAccountKey}}"
+ synchronousPull: "{{synchronousPull}}"
+ maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
+ concurrentConsumers: "{{concurrentConsumers}}"
+ steps:
+ - choice:
+ precondition: true
+ when:
+ - simple: '${properties:getObject:true}'
+ steps:
+ - set-header:
+ name: attributesStorage
+ simple: ${headers.CamelGooglePubsub.Attributes}
+ - log: "${headers.attributesStorage}"
+ - set-property:
+ name: google-storage-event-type
+ simple: "${headers.attributesStorage[eventType]}"
+ - set-property:
+ name: google-storage-object-id
+ simple: "${headers.attributesStorage[objectId]}"
+ - set-property:
+ name: google-storage-bucket-id
+ simple: "${headers.attributesStorage[bucketId]}"
+ - choice:
+ when:
+ - simple: '${exchangeProperty.google-storage-event-type} == "OBJECT_FINALIZE" && ${exchangeProperty.google-storage-bucket-id} == "{{bucketNameOrArn}}"'
+ steps:
+ - toD: >-
+ google-storage:{{bucketNameOrArn}}?serviceAccountKey=base64:{{serviceAccountKey}}&operation=getObject&objectName=${exchangeProperty.google-storage-object-id}
+ - to: 'kamelet:sink'