Skip to content

Commit a2979d3

Browse files
committed
Remove config via standalone mode - always use HTTP call
1 parent f9b7a5a commit a2979d3

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

live-demo-kafka-connect-iot-mqtt-connector.adoc

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ Start Kafka Connect and dependencies (Kafka, Zookeeper, Schema Registry):
5151
[source,bash]
5252
----
5353
confluent start connect
54-
55-
confluent load mqtt-source -d /Users/kai.waehner/confluent-5.0.0/share/confluent-hub-components/confluentinc-kafka-connect-mqtt/etc/source-anonymous.properties
5654
----
5755

58-
If you want to run Kafka Connect in distributed mode, you can do the following REST call without creating a property file (only possible when Connect is running):
56+
We use Kafka Connect in distributed mode via REST call (only possible when Connect is running):
5957

6058
curl -s -X POST -H 'Content-Type: application/json' http://localhost:8083/connectors -d '{
6159
"name" : "mqtt-source",
@@ -68,20 +66,6 @@ If you want to run Kafka Connect in distributed mode, you can do the following R
6866
}
6967
}'
7068

71-
curl -s -X POST -H 'Content-Type: application/json' http://localhost:8083/connectors -d '{
72-
"name" : "mqtt-source",
73-
"config" : {
74-
"connector.class" : "io.confluent.connect.mqtt.MqttSourceConnector",
75-
"tasks.max" : "1",
76-
"mqtt.server.uri" : "tcp://127.0.0.1:1883",
77-
"mqtt.topics" : "temperature",
78-
"kafka.topics" : "mqtt.",
79-
"transforms":"filter",
80-
"transforms.filter.type":"com.github.kaiwaehner.kafka.connect.smt.StringFilter",
81-
"transforms.filter.topic.format":"fraud"
82-
}
83-
}'
84-
8569
Check if connector is loaded and status is 'RUNNING':
8670

8771
[source,bash]
@@ -96,7 +80,9 @@ confluent status connectors
9680
confluent status mqtt-source
9781
----
9882

99-
Create a Kafka Topic for consuming the MQTT messages via the MQTT Connector (needs to be the same as in the Connector Config):
83+
As alternative to a HTTP call, you could also configure a property file for standalone mode. However, as REST can also be used for one single instance (in distributed mode), I always use this option to configure Kafka Connect.
84+
85+
Next, create a Kafka Topic for consuming the MQTT messages via the MQTT Connector (needs to be the same as in the Connector Config):
10086

10187
TODO:
10288
There was a bug in MQTT Connector. If topic `mqtt.temperature` does not receive any messages, the mapping does not work and always use the default value `mqtt.`. Then use `mqtt.` for topic creation AND the kafka-consumer below instead!

0 commit comments

Comments
 (0)