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 2021/07/01 06:19:47 UTC

[camel-kamelets] branch main updated: Enhance mongodb sink kamelet

This is an automated email from the ASF dual-hosted git repository.

acosentino 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 35e81bf  Enhance mongodb sink kamelet
35e81bf is described below

commit 35e81bf409aca0fe9a27b4f540310bbdd691b694
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Fri Jun 25 11:54:41 2021 -0300

    Enhance mongodb sink kamelet
---
 mongodb-sink.kamelet.yaml | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/mongodb-sink.kamelet.yaml b/mongodb-sink.kamelet.yaml
index a24f27c..ec7e07f 100644
--- a/mongodb-sink.kamelet.yaml
+++ b/mongodb-sink.kamelet.yaml
@@ -17,6 +17,10 @@ spec:
       Send documents to MongoDB.
 
       This Kamelet expects a JSON as body.
+
+      Properties you can as headers:
+
+      `db-upsert` / `ce-db-upsert` If the database should create the element if it does not exist. Boolean value.
     required:
       - hosts
       - collection
@@ -48,6 +52,17 @@ spec:
         title: MongoDB Database
         description: Sets the name of the MongoDB database to target.
         type: string
+      writeConcern:
+        title: Write Concern
+        description: Configure the level of acknowledgment requested from MongoDB for write operations, possible values are ACKNOWLEDGED, W1, W2, W3, UNACKNOWLEDGED, JOURNALED, MAJORITY.
+        type: string
+      createCollection:
+        title: Collection
+        description: Create collection during initialisation if it doesn't exist.
+        type: boolean
+        default: false
+        x-descriptors:
+        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
   types:
     in:
       mediaType: application/json
@@ -62,9 +77,23 @@ spec:
     from:
       uri: kamelet:source
       steps:
+      - choice:
+          when:
+          - simple: "${header[db-upsert]}"
+            steps:
+            - set-header:
+                name: CamelMongoDbUpsert
+                simple: "${header[db-upsert]}"
+          - simple: "${header[ce-db-upsert]}"
+            steps:
+            - set-header:
+                name: CamelMongoDbUpsert
+                simple: "${header[ce-db-upsert]}"
       - to: 
           uri: "{{local-mongodb}}:test"
           parameters:
+            createCollection: "{{?createCollection}}"
+            writeConcern: "{{?writeConcern}}"
             hosts: "{{hosts}}"
             collection: "{{collection}}"
             password: "{{password}}"