From 60d1f7be004d546b97b4537b0bb180ce6dfa6ba2 Mon Sep 17 00:00:00 2001 From: nicolaferraro Date: Mon, 18 Oct 2021 18:37:47 +0200 Subject: [PATCH] Fix #544: regen resources --- .../ROOT/assets/images/kamelets/mqtt-sink.svg | 18 +++ docs/modules/ROOT/nav.adoc | 1 + docs/modules/ROOT/pages/mqtt-sink.adoc | 149 ++++++++++++++++++ .../resources/kamelets/mqtt-sink.kamelet.yaml | 43 +++++ .../bindings/camel-k/mqtt-sink-binding.yaml | 19 +++ .../bindings/core/mqtt-sink-binding.yaml | 13 ++ 6 files changed, 243 insertions(+) create mode 100644 docs/modules/ROOT/assets/images/kamelets/mqtt-sink.svg create mode 100644 docs/modules/ROOT/pages/mqtt-sink.adoc create mode 100644 library/camel-kamelets/src/main/resources/kamelets/mqtt-sink.kamelet.yaml create mode 100644 templates/bindings/camel-k/mqtt-sink-binding.yaml create mode 100644 templates/bindings/core/mqtt-sink-binding.yaml diff --git a/docs/modules/ROOT/assets/images/kamelets/mqtt-sink.svg b/docs/modules/ROOT/assets/images/kamelets/mqtt-sink.svg new file mode 100644 index 000000000..9cad0a19f --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/mqtt-sink.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 988035f08..cc7b464fb 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -94,6 +94,7 @@ * xref:ROOT:minio-source.adoc[image:kamelets/minio-source.svg[] Minio Source] * xref:ROOT:mongodb-sink.adoc[image:kamelets/mongodb-sink.svg[] MongoDB Sink] * xref:ROOT:mongodb-source.adoc[image:kamelets/mongodb-source.svg[] MongoDB Source] +* xref:ROOT:mqtt-sink.adoc[image:kamelets/mqtt-sink.svg[] MQTT Sink] * xref:ROOT:mqtt-source.adoc[image:kamelets/mqtt-source.svg[] MQTT Source] * xref:ROOT:mustache-template-action.adoc[image:kamelets/mustache-template-action.svg[] Mustache Template Action] * xref:ROOT:mvel-template-action.adoc[image:kamelets/mvel-template-action.svg[] Mvel Template Action] diff --git a/docs/modules/ROOT/pages/mqtt-sink.adoc b/docs/modules/ROOT/pages/mqtt-sink.adoc new file mode 100644 index 000000000..65afdf987 --- /dev/null +++ b/docs/modules/ROOT/pages/mqtt-sink.adoc @@ -0,0 +1,149 @@ +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT + += image:kamelets/mqtt-sink.svg[] MQTT Sink + +*Provided by: "Apache Software Foundation"* + +*Support Level for this Kamelet is: "Preview"* + +Allows sending messages to any endpoint that supports the MQTT protocol, such as a message broker. + +== Configuration Options + +The following table summarizes the configuration options available for the `mqtt-sink` Kamelet: +[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] +|=== +| Property| Name| Description| Type| Default| Example +| *brokerUrl {empty}* *| Broker URL| The URL of the broker where to establish the connection| string| | `"tcp://mosquitto:1883"` +| *topic {empty}* *| Topic| The topic to send messages to| string| | `"mytopic"` +|=== + +NOTE: Fields marked with an asterisk ({empty}*) are mandatory. + + +== Dependencies + +At runtime, the `mqtt-sink Kamelet relies upon the presence of the following dependencies: + +- camel:paho +- camel:kamelet + +== Usage + +This section describes how you can use the `mqtt-sink`. + +=== Knative Sink + +You can use the `mqtt-sink` Kamelet as a Knative sink by binding it to a Knative object. + +.mqtt-sink-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: mqtt-sink-binding +spec: + source: + ref: + kind: Channel + apiVersion: messaging.knative.dev/v1 + name: mychannel + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: mqtt-sink + properties: + brokerUrl: "tcp://mosquitto:1883" + topic: "mytopic" + +---- + +==== *Prerequisite* + +You have xref:latest@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `mqtt-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the sink by using the following command: ++ +[source,shell] +---- +kubectl apply -f mqtt-sink-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the sink by using the following command: + +[source,shell] +---- +kamel bind channel:mychannel mqtt-sink -p "sink.brokerUrl=tcp://mosquitto:1883" -p "sink.topic=mytopic" +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +=== Kafka Sink + +You can use the `mqtt-sink` Kamelet as a Kafka sink by binding it to a Kafka topic. + +.mqtt-sink-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: mqtt-sink-binding +spec: + source: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: mqtt-sink + properties: + brokerUrl: "tcp://mosquitto:1883" + topic: "mytopic" + +---- + +==== *Prerequisites* + +* You've installed https://strimzi.io/[Strimzi]. +* You've created a topic named `my-topic` in the current namespace. +* You have xref:latest@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `mqtt-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the sink by using the following command: ++ +[source,shell] +---- +kubectl apply -f mqtt-sink-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the sink by using the following command: + +[source,shell] +---- +kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic mqtt-sink -p "sink.brokerUrl=tcp://mosquitto:1883" -p "sink.topic=mytopic" +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +== Kamelet source file + +https://github.com/apache/camel-kamelets/blob/main/mqtt-sink.kamelet.yaml + +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT diff --git a/library/camel-kamelets/src/main/resources/kamelets/mqtt-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/mqtt-sink.kamelet.yaml new file mode 100644 index 000000000..e279e7461 --- /dev/null +++ b/library/camel-kamelets/src/main/resources/kamelets/mqtt-sink.kamelet.yaml @@ -0,0 +1,43 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: mqtt-sink + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "main-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjMuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMiIgYmFzZVByb2ZpbGU9InRpbnkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIKCSB5PSIwcHgiIHZpZXdCb3g9IjAgMCAzMjAgMzIwIiBvdmVyZmxvdz0idmlzaWJsZSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnIGlkPSJibGFja19iZyIgZGlzcGxheT0ibm9uZSI+Cgk8cmVjdCBkaXNwbGF5PSJpbmxpbmUiIHdpZHRoPSIzMjAiIGhlaWdodD0iMzIwIi8+CjwvZz4KPGcgaWQ9ImxvZ29zIj4KCTxnPgoJCTxwYXRoIGZpbGw9IiM2NjAwNjYiIGQ9Ik03LjEsMTgwLjZ2MTE3LjFjMCw4LjQsNi44LDE1LjMsMTUuMywxNS4zSDE0MkMxNDEsMjM5LjgsODAuOSwxODAuNyw3LjEsMTgwLjZ6Ii8+CgkJPHBhdGggZmlsbD0iIzY2MDA2NiIgZD0iTTcuMSw4NC4xdjQ5LjhjOTksMC45LDE3OS40LDgwLjcsMTgwLjQsMTc5LjFoNTEuN0MyMzguMiwxODYuNiwxMzQuNSw4NC4yLDcuMSw4NC4xeiIvPgoJCTxwYXRoIGZpbGw9IiM2NjAwNjYiIGQ9Ik0zMTIuOSwyOTcuNlYxOTMuNUMyNzguMSwxMDcuMiwyMDcuMywzOC45LDExOSw3LjFIMjIuNGMtOC40LDAtMTUuMyw2LjgtMTUuMywxNS4zdjE1CgkJCWMxNTIuNiwwLjksMjc2LjYsMTI0LDI3Ny42LDI3NS42aDEzQzMwNi4xLDMxMi45LDMxMi45LDMwNi4xLDMxMi45LDI5Ny42eiIvPgoJCTxwYXRoIGZpbGw9IiM2NjAwNjYiIGQ9Ik0yNzIuNiw0OS44YzE0LjUsMTQuNCwyOC42LDMxLjcsNDAuNCw0Ny44VjIyLjRjMC04LjQtNi44LTE1LjMtMTUuMy0xNS4zaC03Ny4zCgkJCUMyMzguNCwxOS43LDI1Ni42LDMzLjksMjcyLjYsNDkuOHoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K" + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "MQTT" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "MQTT Sink" + description: |- + Allows sending messages to any endpoint that supports the MQTT protocol, such as a message broker. + required: + - topic + - brokerUrl + type: object + properties: + topic: + title: Topic + description: The topic to send messages to + type: string + example: "mytopic" + brokerUrl: + title: Broker URL + description: The URL of the broker where to establish the connection + type: string + example: "tcp://mosquitto:1883" + dependencies: + - "camel:paho" + - "camel:kamelet" + flow: + from: + uri: kamelet:source + steps: + - to: + uri: paho:{{topic}} + parameters: + brokerUrl: "{{brokerUrl}}" diff --git a/templates/bindings/camel-k/mqtt-sink-binding.yaml b/templates/bindings/camel-k/mqtt-sink-binding.yaml new file mode 100644 index 000000000..84c979ac2 --- /dev/null +++ b/templates/bindings/camel-k/mqtt-sink-binding.yaml @@ -0,0 +1,19 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: mqtt-sink-binding +spec: + source: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: mqtt-sink + properties: + brokerUrl: "tcp://mosquitto:1883" + topic: "mytopic" + \ No newline at end of file diff --git a/templates/bindings/core/mqtt-sink-binding.yaml b/templates/bindings/core/mqtt-sink-binding.yaml new file mode 100644 index 000000000..624d3436d --- /dev/null +++ b/templates/bindings/core/mqtt-sink-binding.yaml @@ -0,0 +1,13 @@ +- route: + from: + uri: "kamelet:timer-source" + parameters: + period: 1000 + message: "Hello Camel JBang" + steps: + - to: + uri: "kamelet:mqtt-sink" + parameters: + brokerUrl: "tcp://mosquitto:1883" + topic: "mytopic" + \ No newline at end of file