You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/04 14:55:13 UTC

[camel] branch main updated: Fixed default host and port for zeebe service and improved documentation with JSON examples (#9804)

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


The following commit(s) were added to refs/heads/main by this push:
     new 23f297aeb3c Fixed default host and port for zeebe service and improved documentation with JSON examples (#9804)
23f297aeb3c is described below

commit 23f297aeb3c90d5de656b68134e36dde1a68524c
Author: LoRez <ka...@me.com>
AuthorDate: Tue Apr 4 16:55:04 2023 +0200

    Fixed default host and port for zeebe service and improved documentation with JSON examples (#9804)
---
 components/camel-zeebe/pom.xml                     |  2 +-
 .../camel-zeebe/src/main/docs/zeebe-component.adoc | 48 ++++++++++++++++++++++
 .../camel/component/zeebe/ZeebeComponent.java      |  4 +-
 .../camel/component/zeebe/ZeebeComponentTest.java  | 34 +++++++++++++++
 4 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/components/camel-zeebe/pom.xml b/components/camel-zeebe/pom.xml
index 451ae9f1559..330019a7ad0 100644
--- a/components/camel-zeebe/pom.xml
+++ b/components/camel-zeebe/pom.xml
@@ -34,7 +34,7 @@
     <properties>
         <firstVersion>3.21</firstVersion>
         <supportLevel>Experimental</supportLevel>
-        <zeebe.version>8.1.6</zeebe.version>
+        <zeebe.version>8.1.9</zeebe.version>
     </properties>
 
     <dependencies>
diff --git a/components/camel-zeebe/src/main/docs/zeebe-component.adoc b/components/camel-zeebe/src/main/docs/zeebe-component.adoc
index 4a28877c8dd..6df2f09a43f 100644
--- a/components/camel-zeebe/src/main/docs/zeebe-component.adoc
+++ b/components/camel-zeebe/src/main/docs/zeebe-component.adoc
@@ -71,6 +71,8 @@ include::partial$component-endpoint-options.adoc[]
 
 |=======================================================================
 
+The endpoints accept either Java request objects as shown in the examples below or JSON. In JSON camel case for property names is replaced with all lower case seperated by underscores, e.g. processId becomes process_id.
+
 *Examples*
 
 * startProcess
@@ -94,6 +96,29 @@ include::partial$component-endpoint-options.adoc[]
         });
 ----------------------------------------------------------------------------------------------------------------------
 
+*JSON Request Example*
+
+[source,json]
+----------------------------------------------------------------------------------------------------------------------
+    {
+        "process_id" : "Process_0e3ldfm",
+        "variables" : { "v1": "a", "v2": 10 }
+    }
+----------------------------------------------------------------------------------------------------------------------
+
+*JSON Response Example*
+
+[source,json]
+----------------------------------------------------------------------------------------------------------------------
+    {
+        "success": true,
+        "process_id": "Process_0e3ldfm",
+        "process_instance_key": 2251799813688297,
+        "process_version": 4,
+        "process_key": 2251799813685906
+    }
+----------------------------------------------------------------------------------------------------------------------
+
 * cancelProcess
 
 [source,java]
@@ -136,6 +161,29 @@ include::partial$component-endpoint-options.adoc[]
         });
 ----------------------------------------------------------------------------------------------------------------------
 
+*JSON Request Example*
+
+[source,json]
+----------------------------------------------------------------------------------------------------------------------
+    {
+        "correlation_key" : "messageKey",
+        "time-to-live" : 100,
+        "variables" : { "v1": "a", "v2": 10 },
+        "name" : "MessageName"
+    }
+----------------------------------------------------------------------------------------------------------------------
+
+*JSON Response Example*
+
+[source,json]
+----------------------------------------------------------------------------------------------------------------------
+    {
+        "success": true,
+        "correlation_key": "messageKey",
+        "message_key": 2251799813688336
+    }
+----------------------------------------------------------------------------------------------------------------------
+
 * completeJob
 
 [source,java]
diff --git a/components/camel-zeebe/src/main/java/org/apache/camel/component/zeebe/ZeebeComponent.java b/components/camel-zeebe/src/main/java/org/apache/camel/component/zeebe/ZeebeComponent.java
index fdd072b649b..d208816eaec 100644
--- a/components/camel-zeebe/src/main/java/org/apache/camel/component/zeebe/ZeebeComponent.java
+++ b/components/camel-zeebe/src/main/java/org/apache/camel/component/zeebe/ZeebeComponent.java
@@ -29,9 +29,9 @@ import org.apache.camel.support.DefaultComponent;
 public class ZeebeComponent extends DefaultComponent {
 
     @Metadata(defaultValue = "" + ZeebeConstants.DEFAULT_GATEWAY_HOST, label = "security")
-    String gatewayHost;
+    String gatewayHost = ZeebeConstants.DEFAULT_GATEWAY_HOST;
     @Metadata(defaultValue = "" + ZeebeConstants.DEFAULT_GATEWAY_PORT, label = "security")
-    int gatewayPort;
+    int gatewayPort = ZeebeConstants.DEFAULT_GATEWAY_PORT;
     @Metadata(label = "security", secret = true)
     String clientId;
     @Metadata(label = "security", secret = true)
diff --git a/components/camel-zeebe/src/test/java/org/apache/camel/component/zeebe/ZeebeComponentTest.java b/components/camel-zeebe/src/test/java/org/apache/camel/component/zeebe/ZeebeComponentTest.java
new file mode 100644
index 00000000000..64e8f8aba74
--- /dev/null
+++ b/components/camel-zeebe/src/test/java/org/apache/camel/component/zeebe/ZeebeComponentTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package org.apache.camel.component.zeebe;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class ZeebeComponentTest {
+
+    @Test
+    void getZeebeService() {
+        // Verify Defaults
+        ZeebeComponent component = new ZeebeComponent();
+
+        assertEquals(component.getGatewayHost(), ZeebeConstants.DEFAULT_GATEWAY_HOST);
+        assertEquals(component.getGatewayPort(), ZeebeConstants.DEFAULT_GATEWAY_PORT);
+    }
+}