From f36ec11e08f46edd6dda104f4122376b0cbe6103 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Tue, 9 Mar 2021 08:43:00 +0100 Subject: [PATCH 1/3] Added RabbitMQ Source Kamelet --- rabbitmq-source.kamelet.yaml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 rabbitmq-source.kamelet.yaml diff --git a/rabbitmq-source.kamelet.yaml b/rabbitmq-source.kamelet.yaml new file mode 100644 index 000000000..51bc56101 --- /dev/null +++ b/rabbitmq-source.kamelet.yaml @@ -0,0 +1,54 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: rabbitmq-source + annotations: + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjcxcHgiIGhlaWdodD0iMjcxcHgiIHZpZXdCb3g9Ii03LjUgMCAyNzEgMjcxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjQ1LjQ0IDEwOC4zMDhoLTg1LjA5YTcuNzM4IDcuNzM4IDAgMCAxLTcuNzM1LTcuNzM0di04OC42OEMxNTIuNjE1IDUuMzI3IDE0Ny4yOSAwIDE0MC43MjYgMGgtMzAuMzc1Yy02LjU2OCAwLTExLjg5IDUuMzI3LTExLjg5IDExLjg5NHY4OC4xNDNjMCA0LjU3My0zLjY5NyA4LjI5LTguMjcgOC4zMWwtMjcuODg1LjEzM2MtNC42MTIuMDI1LTguMzU5LTMuNzE3LTguMzUtOC4zMjVsLjE3My04OC4yNDFDNTQuMTQ0IDUuMzM3IDQ4LjgxNyAwIDQyLjI0IDBIMTEuODlDNS4zMjEgMCAwIDUuMzI3IDAgMTEuODk0VjI2MC4yMWMwIDUuODM0IDQuNzI2IDEwLjU2IDEwLjU1NSAxMC41NkgyNDUuNDRjNS44MzQgMCAxMC41Ni00LjcyNiAxMC41Ni0xMC41NlYxMTguODY4YzAtNS44MzQtNC43MjYtMTAuNTYtMTAuNTYtMTAuNTZ6bS0zOS45MDIgOTMuMjMzYzAgNy42NDUtNi4xOTggMTMuODQ0LTEzLjg0MyAxMy44NDRIMTY3LjY5Yy03LjY0NiAwLTEzLjg0NC02LjE5OS0xMy44NDQtMTMuODQ0di0yNC4wMDVjMC03LjY0NiA2LjE5OC0xMy44NDQgMTMuODQ0LTEzLjg0NGgyNC4wMDVjNy42NDUgMCAxMy44NDMgNi4xOTggMTMuODQzIDEzLjg0NHYyNC4wMDV6IiBmaWxsPSIjRjYwIi8+PC9zdmc+" + camel.apache.org/provider: "Apache Software Foundation" + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "RabbitMQ Source" + description: |- + Receive data from an RabbitMQ Brokers. + required: + - addresses + - exchangeName + - username + - password + properties: + addresses: + title: Addresses + description: Comma separated list of RabbitMQ broker addresses + type: string + port: + title: Port + description: Port of the RabbitMQ server + type: string + default: 5672 + username: + title: Username + description: The username to access the RabbitMQ server + type: string + password: + title: Password + description: The password to access the RabbitMQ server + type: string + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + exchangeName: + title: Exchange name + description: The exchange name determines the exchange the queue will be bound to + type: string + flow: + from: + uri: "rabbitmq://{{exchangeName}}" + parameters: + password: "{{password}}" + username: "{{username}}" + addresses: "{{addresses}}" + steps: + - convert-body-to: + type: "java.lang.String" + - to: "kamelet:sink" From 59bebb2010beb98b4897efc3384198e8b40e3c13 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Tue, 9 Mar 2021 08:43:30 +0100 Subject: [PATCH 2/3] Added RabbitMQ source kamelet --- .../images/kamelets/rabbitmq-source.svg | 1 + docs/modules/ROOT/nav.adoc | 1 + docs/modules/ROOT/pages/rabbitmq-source.adoc | 67 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 docs/modules/ROOT/assets/images/kamelets/rabbitmq-source.svg create mode 100644 docs/modules/ROOT/pages/rabbitmq-source.adoc diff --git a/docs/modules/ROOT/assets/images/kamelets/rabbitmq-source.svg b/docs/modules/ROOT/assets/images/kamelets/rabbitmq-source.svg new file mode 100644 index 000000000..0873065fd --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/rabbitmq-source.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 6aec6350d..360f971cc 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -12,6 +12,7 @@ * xref:ROOT:minio-source.adoc[image:kamelets/minio-source.svg[] Minio Source] * xref:ROOT:mqtt-source.adoc[image:kamelets/mqtt-source.svg[] MQTT Source] * xref:ROOT:nats-source.adoc[image:kamelets/nats-source.svg[] NATS Source] +* xref:ROOT:rabbitmq-source.adoc[image:kamelets/rabbitmq-source.svg[] RabbitMQ Source] * xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source] * xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source] * xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source] diff --git a/docs/modules/ROOT/pages/rabbitmq-source.adoc b/docs/modules/ROOT/pages/rabbitmq-source.adoc new file mode 100644 index 000000000..7937241e2 --- /dev/null +++ b/docs/modules/ROOT/pages/rabbitmq-source.adoc @@ -0,0 +1,67 @@ +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT += image:kamelets/rabbitmq-source.svg[] RabbitMQ Source + +*Provided by: "Apache Software Foundation"* + +Receive data from an RabbitMQ Brokers. + +== Configuration Options + +The following table summarizes the configuration options available for the `rabbitmq-source` Kamelet: +[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] +|=== +| Property| Name| Description| Type| Default| Example +| *addresses {empty}* *| Addresses| Comma separated list of RabbitMQ broker addresses| string| | +| *exchangeName {empty}* *| Exchange name| The exchange name determines the exchange the queue will be bound to| string| | +| *password {empty}* *| Password| The password to access the RabbitMQ server| string| | +| *username {empty}* *| Username| The username to access the RabbitMQ server| string| | +| port| Port| Port of the RabbitMQ server| string| `5672`| +|=== + +NOTE: Fields marked with ({empty}*) are mandatory. + +== Usage + +This section summarizes how the `rabbitmq-source` can be used in various contexts. + +=== Knative Source + +The `rabbitmq-source` Kamelet can be used as Knative source by binding it to a Knative object. + +.rabbitmq-source-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: rabbitmq-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: rabbitmq-source + properties: + addresses: "The Addresses" + exchangeName: "The Exchange name" + password: "The Password" + username: "The Username" + sink: + ref: + kind: InMemoryChannel + apiVersion: messaging.knative.dev/v1 + name: mychannel + +---- + +Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to. + +Save the `rabbitmq-source-binding.yaml` file into your hard drive, then configure it according to your needs. + +You can run the source using the following command: + +[source,shell] +---- +kubectl apply -f rabbitmq-source-binding.yaml +---- +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT From 90453d5d7daf320d05df5a6f4a74127dd9ea6338 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Tue, 9 Mar 2021 09:21:01 +0100 Subject: [PATCH 3/3] RabbitMQ: No need for String conversion --- rabbitmq-source.kamelet.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/rabbitmq-source.kamelet.yaml b/rabbitmq-source.kamelet.yaml index 51bc56101..1c7780ed2 100644 --- a/rabbitmq-source.kamelet.yaml +++ b/rabbitmq-source.kamelet.yaml @@ -49,6 +49,4 @@ spec: username: "{{username}}" addresses: "{{addresses}}" steps: - - convert-body-to: - type: "java.lang.String" - to: "kamelet:sink"