Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 670d07a

Browse files
authored
Change mqtt.kafka.asyncapi.proxy to streetlight (#119)
1 parent 59fc0a9 commit 670d07a

File tree

4 files changed

+295
-74
lines changed

4 files changed

+295
-74
lines changed

mqtt.kafka.asyncapi.proxy/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,50 @@ Wether you chose [compose](./docker/compose) or [helm](./k8s/helm), the `setup.s
2222

2323
### Using this example
2424

25-
Using eclipse-mosquitto subscribe to the sensors/# topic.
25+
Using eclipse-mosquitto subscribe to the `smartylighting/streetlights/1/0/event/+/lighting/measured` topic.
2626

2727
```bash
28-
mosquitto_sub -V '5' -t 'sensors/#' -d -p 7183
28+
mosquitto_sub -V '5' -t 'smartylighting/streetlights/1/0/event/+/lighting/measured' -d -p 7183
2929
```
3030

3131
output:
3232

3333
```
3434
Client null sending CONNECT
35-
Client 7f37e11e-8f79-458a-a4b3-3ffb36a9e08b received CONNACK (0)
36-
Client 7f37e11e-8f79-458a-a4b3-3ffb36a9e08b sending SUBSCRIBE (Mid: 1, Topic: sensors/#, QoS: 0, Options: 0x00)
37-
Client 7f37e11e-8f79-458a-a4b3-3ffb36a9e08b received SUBACK
35+
Client 26c02b9a-0e29-44c6-9f0e-277655c8d712 received CONNACK (0)
36+
Client 26c02b9a-0e29-44c6-9f0e-277655c8d712 sending SUBSCRIBE (Mid: 1, Topic: smartylighting/streetlights/1/0/event/+/lighting/measured, QoS: 0, Options: 0x00)
37+
Client 26c02b9a-0e29-44c6-9f0e-277655c8d712 received SUBACK
3838
Subscribed (mid: 1): 0
39-
Client 7f37e11e-8f79-458a-a4b3-3ffb36a9e08b received PUBLISH (d0, q0, r0, m0, 'sensors/1', ... (24 bytes))
40-
{"id":"1","status":"on"}
39+
Client 26c02b9a-0e29-44c6-9f0e-277655c8d712 received PUBLISH (d0, q0, r0, m0, 'smartylighting/streetlights/1/0/event/5/lighting/measured', ... (49 bytes))
40+
{"lumens":50,"sentAt":"2024-06-07T12:34:32.000Z"}
4141
```
4242

43-
In a separate session, publish a valid message on the sensors/1 topic.
43+
In a separate session, publish a valid message on the `smartylighting/streetlights/1/0/event/1/lighting/measured` topic.
4444

4545
```bash
46-
mosquitto_pub -V '5' -t 'sensors/1' -m '{"id":"1","status":"on"}' -d -p 7183
46+
mosquitto_pub -V '5' -t 'smartylighting/streetlights/1/0/event/1/lighting/measured' -m '{"lumens":50,"sentAt":"2024-06-07T12:34:32.000Z"}' -d -p 7183
4747
```
4848

4949
output:
5050

5151
```
5252
Client null sending CONNECT
53-
Client 2fc05cdc-5e1d-4e00-be18-0026ae47e749 received CONNACK (0)
54-
Client 2fc05cdc-5e1d-4e00-be18-0026ae47e749 sending PUBLISH (d0, q0, r0, m1, 'sensors/1', ... (24 bytes))
55-
Client 2fc05cdc-5e1d-4e00-be18-0026ae47e749 sending DISCONNECT
53+
Client a1f4ad8c-c9e8-4671-ad46-69030d4f1c9a received CONNACK (0)
54+
Client a1f4ad8c-c9e8-4671-ad46-69030d4f1c9a sending PUBLISH (d0, q0, r0, m1, 'smartylighting/streetlights/1/0/event/1/lighting/measured', ... (49 bytes))
55+
Client a1f4ad8c-c9e8-4671-ad46-69030d4f1c9a sending DISCONNECT
5656
```
5757

58-
Now attempt to publish an invalid message, with property `stat` instead of `status`.
58+
Now attempt to publish an invalid message by setting `lumens` property to a negative value.
5959

6060
```bash
61-
mosquitto_pub -V '5' -t 'sensors/1' -m '{"id":"1","stat":"off"}' -d -p 7183 --repeat 2 --repeat-delay 3
61+
mosquitto_pub -V '5' -t 'smartylighting/streetlights/1/0/event/1/lighting/measured' -m '{"lumens":-1,"sentAt":"2024-06-07T12:34:32.000Z"}' -d -p 7183 --repeat 2 --repeat-delay 3
6262
```
6363

6464
output:
65-
6665
```
6766
Client null sending CONNECT
68-
Client cd166c27-de75-4a2e-b3c7-f16631bda2a9 received CONNACK (0)
69-
Client cd166c27-de75-4a2e-b3c7-f16631bda2a9 sending PUBLISH (d0, q0, r0, m1, 'sensors/1', ... (23 bytes))
67+
Client 30157eed-0ea7-42c6-91e8-466d1dd0ab66 received CONNACK (0)
68+
Client 30157eed-0ea7-42c6-91e8-466d1dd0ab66 sending PUBLISH (d0, q0, r0, m1, 'smartylighting/streetlights/1/0/event/1/lighting/measured', ... (49 bytes))
7069
Received DISCONNECT (153)
7170
Error: The client is not currently connected.
7271
```

mqtt.kafka.asyncapi.proxy/docker/compose/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [[ -z $(docker-compose -p $NAMESPACE ps -q zilla) ]]; then
1717
docker run --rm bitnami/kafka:3.2 bash -c "
1818
echo 'Creating topics for $KAFKA_HOST:$KAFKA_PORT'
1919
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-messages
20-
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic sensors
20+
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic streetlights
2121
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-retained --config cleanup.policy=compact
2222
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-sessions --config cleanup.policy=compact
2323
"

mqtt.kafka.asyncapi.proxy/k8s/helm/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ helm upgrade --install zilla $ZILLA_CHART --namespace $NAMESPACE --create-namesp
2020
kubectl run kafka-init-pod --image=bitnami/kafka:3.2 --namespace $NAMESPACE --rm --restart=Never -i -t -- /bin/sh -c "
2121
echo 'Creating topics for $KAFKA_HOST:$KAFKA_PORT'
2222
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-messages
23-
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic sensors
23+
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic streetlights
2424
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-retained --config cleanup.policy=compact
2525
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --create --if-not-exists --topic mqtt-sessions --config cleanup.policy=compact
2626
"

0 commit comments

Comments
 (0)