## Compile the plugins ### plugins/go.mod ```go module plugins go 1.13 replace github.com/emqx/kuiper => /$kuiper require ( github.com/emqx/kuiper v0.0.0-00010101000000-000000000000 // indirect github.com/taosdata/driver-go v0.0.0-20200723061832-5be6460b0c20 ) ``` ```shell go mod edit -replace github.com/emqx/kuiper=/$kuiper go build --buildmode=plugin -o /$kuiper/plugins/sinks/Taos@v1.0.0.so /$kuiper/plugins/sinks/taos.go ``` ## Rule Actions Description | Name | Type | Optional | Description | | -------- | -------- | ------------------------------------------------- | ---------------------- | | ip | string | false | Database ip | | port | int | false | Database port | | user | string | false | Username | | password | string | false | Password | | database | string | false | Database name | | table | string | false | Table Name | | fields | []string | true(Replace with data key when not filling in) | Table field collection | ## Operation example ### To create a database or table, refer to the following documents: ```http https://www.taosdata.com/cn/getting-started/ ``` ### Create a stream ```curl curl --location --request POST 'http://127.0.0.1:9081/streams' --header 'Content-Type:application/json' --data '{"sql":"create stream demoStream(time string, age BIGINT) WITH ( DATASOURCE = \"device/+/message\", FORMAT = \"json\");"}' ``` ### Create a rule ```curl curl --location --request POST 'http://127.0.0.1:9081/rules' --header 'Content-Type:application/json' --data '{"id":"demoRule","sql":"SELECT * FROM demoStream;","actions":[{"taos":{"port":0,"ip":"127.0.0.1","user":"root","password":"taosdata","database":"dbName","table":"tableName","fields":["time","age"]}}]}' ``` ### Send data ```curl mosquitto_pub -h broker.emqx.io -m '{"time":"2020-01-11 18:18:18", "age" : 18}' -t device/device_001/message ```