forked from apache/camel-kamelets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
106a54b
commit 60d1f7b
Showing
6 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
43 changes: 43 additions & 0 deletions
43
library/camel-kamelets/src/main/resources/kamelets/mqtt-sink.kamelet.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjMuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg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RjMC04LjQtNi44LTE1LjMtMTUuMy0xNS4zaC03Ny4zCgkJCUMyMzguNCwxOS43LDI1Ni42LDMzLjksMjcyLjYsNDkuOHoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K" | ||
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}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|