Skip to content

Commit

Permalink
feat: inbound RabbitMQ Connector (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
chillleader authored Apr 26, 2023
1 parent 1173550 commit 8bd00c2
Show file tree
Hide file tree
Showing 41 changed files with 1,639 additions and 154 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Configuration for running connectors locally in bundle with connector-runtime
server.port=9898
zeebe.broker.gateway-address=localhost:26500
zeebe.client.security.plaintext=true
#zeebe.broker.gateway-address=localhost:26500
#zeebe.client.security.plaintext=true

management.server.port=9080
management.context-path=/actuator
management.endpoints.web.exposure.include=metrics,health,prometheus
management.endpoints.web.exposure.include=metrics,health,prometheus

camunda.connector.polling.enabled=true
camunda.connector.polling.interval=5000

camunda.connector.webhook.enabled=true

camunda.operate.client.username=demo
camunda.operate.client.password=demo
camunda.operate.client.url=http://localhost:8081
logging.level.io.camunda.connector=trace
11 changes: 10 additions & 1 deletion connectors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ except in compliance with the proprietary license.</license.inlineheader>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


Expand Down
10 changes: 5 additions & 5 deletions connectors/rabbitmq/element-templates/rabbitmq-connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"notEmpty": true,
"pattern": {
"value": "^(amqps?://)|(secrets).*",
"message": "Must start with amqp(s)://"
"message": "Must start with amqp(s):// or contain a secret reference"
}
},
"condition": {
Expand Down Expand Up @@ -121,7 +121,7 @@
},
{
"label": "Host name",
"description": "Host name: get from RabbitMQ external app configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"description": "Host name: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"feel": "optional",
"group": "routing",
"type": "String",
Expand All @@ -139,7 +139,7 @@
},
{
"label": "Virtual host",
"description": "Virtual name: get from RabbitMQ external app configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"description": "Virtual name: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"feel": "optional",
"group": "routing",
"type": "String",
Expand All @@ -157,7 +157,7 @@
},
{
"label": "Exchange",
"description": "Topic exchange: get from RabbitMQ external app configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"description": "Topic exchange: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"feel": "optional",
"group": "routing",
"type": "String",
Expand Down Expand Up @@ -185,7 +185,7 @@
},
{
"label": "Port",
"description": "Port: get from RabbitMQ external app configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"description": "Port: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"feel": "optional",
"group": "routing",
"type": "String",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "RabbitMQ Connector",
"id": "io.camunda.connectors.inbound.RabbitMQ.StartEvent.v1",
"version": 1,
"description": "Receive a message from RabbitMQ",
"documentationRef": "https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq",
"category": {
"id": "connectors",
"name": "Connectors"
},
"appliesTo": [
"bpmn:StartEvent"
],
"elementType": {
"value": "bpmn:StartEvent"
},
"groups": [
{
"id": "authentication",
"label": "Authentication"
},
{
"id": "routing",
"label": "Routing"
},
{
"id": "subscription",
"label": "Subscription"
},
{
"id": "activation",
"label": "Activation"
},
{
"id": "variable-mapping",
"label": "Variable Mapping"
}
],
"properties": [
{
"type": "Hidden",
"value": "io.camunda:connector-rabbitmq-inbound:1",
"binding": {
"type": "zeebe:property",
"name": "inbound.type"
}
},
{
"id": "connectionType",
"label": "Connection Type",
"group": "authentication",
"type": "Dropdown",
"value": "uri",
"binding": {
"type": "zeebe:property",
"name": "authentication.authType"
},
"choices": [
{
"name": "URI",
"value": "uri"
},
{
"name": "Username/Password",
"value": "credentials"
}
]
},
{
"label": "URI",
"description": "URI should contain username, password, host name, port number, and virtual host",
"group": "authentication",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "authentication.uri"
},
"constraints": {
"notEmpty": true,
"pattern": {
"value": "^(amqps?://)|(secrets).*",
"message": "Must start with amqp(s):// or contain a secret reference"
}
},
"condition": {
"property": "connectionType",
"equals": "uri"
}
},
{
"label": "Username",
"group": "authentication",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "authentication.userName"
},
"constraints": {
"notEmpty": true
},
"condition": {
"property": "connectionType",
"equals": "credentials"
}
},
{
"label": "Password",
"group": "authentication",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "authentication.password"
},
"constraints": {
"notEmpty": true
},
"condition": {
"property": "connectionType",
"equals": "credentials"
}
},
{
"label": "Host name",
"description": "Host name: get from RabbitMQ external applocation configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"group": "routing",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "routing.hostName"
},
"constraints": {
"notEmpty": true
},
"condition": {
"property": "connectionType",
"equals": "credentials"
}
},
{
"label": "Virtual host",
"description": "Virtual name: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"group": "routing",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "routing.virtualHost"
},
"constraints": {
"notEmpty": true
},
"condition": {
"property": "connectionType",
"equals": "credentials"
}
},
{
"label": "Port",
"description": "Port: get from RabbitMQ external application configurations. Details in the <a href=\"https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/#routing-data\"target=\"_blank\">documentation</a>",
"group": "routing",
"type": "String",
"binding": {
"type": "zeebe:property",
"name": "routing.port"
},
"constraints": {
"notEmpty": true
},
"condition": {
"property": "connectionType",
"equals": "credentials"
}
},
{
"label": "Queue name",
"description": "Name of the queue to subscribe to",
"group": "subscription",
"type": "String",
"feel": "optional",
"binding": {
"type": "zeebe:property",
"name": "queueName"
},
"constraints": {
"notEmpty": true
}
},
{
"label": "Consumer tag",
"description": "Consumer tag to use for the subscription",
"group": "subscription",
"type": "String",
"feel": "optional",
"binding": {
"type": "zeebe:property",
"name": "consumerTag"
}
},
{
"label": "Arguments",
"description": "Arguments to use for the subscription",
"group": "subscription",
"type": "String",
"feel": "required",
"binding": {
"type": "zeebe:property",
"name": "arguments"
}
},
{
"label": "Exclusive consumer",
"group": "subscription",
"type": "Dropdown",
"value": "false",
"binding": {
"type": "zeebe:property",
"name": "exclusive"
},
"choices": [
{
"name": "Yes",
"value": "true"
},
{
"name": "No",
"value": "false"
}
]
},
{
"label": "Activation condition",
"type": "String",
"group": "activation",
"feel": "required",
"optional": true,
"binding": {
"type": "zeebe:property",
"name": "activationCondition"
},
"description": "Condition under which the Connector triggers. Leave empty to catch all events"
},
{
"label": "Result Variable",
"type": "String",
"group": "variable-mapping",
"optional": true,
"binding": {
"type": "zeebe:property",
"name": "resultVariable"
},
"description": "Name of variable to store the result of the Connector in"
},
{
"label":"Result Expression",
"type": "String",
"group": "variable-mapping",
"feel": "required",
"optional": true,
"binding": {
"type": "zeebe:property",
"name": "resultExpression"
},
"description": "Expression to map the inbound payload to process variables"
}
],
"icon": {
"contents": "data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='-7.5 0 271 271' preserveAspectRatio='xMidYMid'%3E%3Cpath d='M245.44 108.308h-85.09a7.738 7.738 0 0 1-7.735-7.734v-88.68C152.615 5.327 147.29 0 140.726 0h-30.375c-6.568 0-11.89 5.327-11.89 11.894v88.143c0 4.573-3.697 8.29-8.27 8.31l-27.885.133c-4.612.025-8.359-3.717-8.35-8.325l.173-88.241C54.144 5.337 48.817 0 42.24 0H11.89C5.321 0 0 5.327 0 11.894V260.21c0 5.834 4.726 10.56 10.555 10.56H245.44c5.834 0 10.56-4.726 10.56-10.56V118.868c0-5.834-4.726-10.56-10.56-10.56zm-39.902 93.233c0 7.645-6.198 13.844-13.843 13.844H167.69c-7.646 0-13.844-6.199-13.844-13.844v-24.005c0-7.646 6.198-13.844 13.844-13.844h24.005c7.645 0 13.843 6.198 13.843 13.844v24.005z' fill='%23F60'/%3E%3C/svg%3E"
}
}
6 changes: 6 additions & 0 deletions connectors/rabbitmq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<artifactId>amqp-client</artifactId>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>rabbitmq</artifactId>
<version>${version.testcontainers}</version>
</dependency>

<!-- This dependency will be removed after camunda/zeebe#9859 is resolved. -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See the License.txt file for more information. You may not use this file
* except in compliance with the proprietary license.
*/
package io.camunda.connector.rabbitmq.model;
package io.camunda.connector.rabbitmq.common.model;

import io.camunda.connector.api.annotation.Secret;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See the License.txt file for more information. You may not use this file
* except in compliance with the proprietary license.
*/
package io.camunda.connector.rabbitmq.model;
package io.camunda.connector.rabbitmq.common.model;

public enum RabbitMqAuthenticationType {
uri,
Expand Down
Loading

0 comments on commit 8bd00c2

Please sign in to comment.