55Download the plugin:
66
77``` bash
8- wget https://github.com/savonarola/emqx-offline-message-plugin/releases/download/v0.0.4 /emqx_offline_message_plugin-1.0.0.tar.gz
8+ wget https://github.com/savonarola/emqx-offline-message-plugin/releases/download/v0.0.7 /emqx_offline_message_plugin-1.0.0.tar.gz
99```
1010
1111Install the plugin:
@@ -22,46 +22,7 @@ Check the plugin is installed:
2222curl -u key:secret http://localhost:18083/api/v5/plugins | jq
2323```
2424
25- Add connector:
26-
27- ``` bash
28- curl -u key:secret -X POST http://localhost:18083/api/v5/connectors \
29- -H " Content-Type: application/json" \
30- -d ' {"type":"mysql","name":"omp","server":"mysql","database":"emqx","pool_size":8,"username":"emqx","password":"public","resource_opts":{"start_timeout":"5s","health_check_interval":"15s"}}'
31-
32- curl -s -u key:secret http://localhost:18083/api/v5/connectors | jq
33- ```
34-
35- Add publish action:
36-
37- ``` bash
38- curl -u key:secret -X POST http://localhost:18083/api/v5/actions \
39- -H " Content-Type: application/json" \
40- -d ' {"type":"mysql","parameters":{"undefined_vars_as_null":false,"sql":"insert into mqtt_msg(msgid, sender, topic, qos, retain, payload, arrived) values(${id}, ${clientid}, ${topic}, ${qos}, ${retain}, ${payload}, FROM_UNIXTIME(${timestamp}/1000))"},"name":"omp_publish_action","enable":true,"connector":"omp"}'
41-
42- curl -s -u key:secret http://localhost:18083/api/v5/actions | jq
43- ```
44-
45- Add publish rule:
46-
47- ``` bash
48- curl -u key:secret -X POST http://localhost:18083/api/v5/rules \
49- -H " Content-Type: application/json" \
50- -d ' {"sql":"SELECT id, clientid, topic, qos, payload, timestamp, int(coalesce(flags.retain, 0)) as retain FROM \"t/#\" WHERE qos = 1 or qos = 2","name":"omp_publish_rule","description":"Offline Message Plugin Publish Action","actions":["mysql:omp_publish_action"]}'
51-
52- curl -s -u key:secret http://localhost:18083/api/v5/rules | jq
53- ```
54-
55- Add subscribe/ack rule.
56- This the only configuration change that is unavailable from the Dashboard.
57-
58- ``` bash
59- curl -u key:secret -X POST http://localhost:18083/api/v5/rules \
60- -H " Content-Type: application/json" \
61- -d ' {"sql":"SELECT * FROM \"$events/session_subscribed\", \"$events/message_acked\" WHERE topic =~ ' " '" ' t/#' " '" ' ","name":"omp_subscribe_ack_rule","description":"Offline Message Plugin Subscribe/Ack Action","actions":[{"function":"emqx_omp:action","args":{"opts":{},"connector_name":"mysql:omp"}}]}'
62-
63- curl -s -u key:secret http://localhost:18083/api/v5/rules | jq
64- ```
25+ Configure the plugin in the Dashboard: http://localhost:18083/#/plugins/detail/emqx_offline_message_plugin-1.0.0
6526
6627Verify:
6728
0 commit comments