{"id":26582827,"url":"https://github.com/senx/warp10-plugin-mqtt","last_synced_at":"2026-04-30T00:37:52.339Z","repository":{"id":51185105,"uuid":"171853762","full_name":"senx/warp10-plugin-mqtt","owner":"senx","description":"Warp 10™ MQTT Plugin","archived":false,"fork":false,"pushed_at":"2023-06-28T15:22:02.000Z","size":134,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T13:10:28.665Z","etag":null,"topics":["iot","mqtt","warp10","warpscript"],"latest_commit_sha":null,"homepage":"https://warp10.io/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/senx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-21T10:46:51.000Z","updated_at":"2021-10-08T10:05:50.000Z","dependencies_parsed_at":"2022-09-22T21:40:49.157Z","dependency_job_id":null,"html_url":"https://github.com/senx/warp10-plugin-mqtt","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senx%2Fwarp10-plugin-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senx%2Fwarp10-plugin-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senx%2Fwarp10-plugin-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senx%2Fwarp10-plugin-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/senx","download_url":"https://codeload.github.com/senx/warp10-plugin-mqtt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072266,"owners_count":20556353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iot","mqtt","warp10","warpscript"],"created_at":"2025-03-23T08:17:46.562Z","updated_at":"2026-04-30T00:37:52.310Z","avatar_url":"https://github.com/senx.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plugin purpose \n\nThe Warp 10™ MQTT Plugin allows you to subscribe to any MQTT topics and attach a WarpScript™ to process incoming MQTT messages.\n\n# Compilation\n\n```\ngit clone \"https://github.com/senx/warp10-plugin-mqtt.git\"\ncd warp10-plugin-mqtt\n./gradlew shadowJar\n```\n\nCopy the jar in your Warp 10™ `lib` directory\n```\ncp build/libs/warp10-plugin-mqtt-*.jar myWarp10path/lib/\n```\n\n\n# Configuration\n\nOpen your Warp 10™ configuration file: default path is `myWarp10path/etc/conf-standalone.conf`.\n\nAt the end of the file, add the following lines:\n\n```\n//\n// Load the MQTT plugin\n//\nwarp10.plugin.mqtt = io.warp10.plugins.mqtt.MQTTWarp10Plugin\n\n//\n// mqtt options: the home directory of WarpScript MQTT handlers\n//\nmqtt.dir = ${standalone.home}/mqtt\n\n//\n// mqtt options: scan changes in the directory every 10000ms. \n//\nmqtt.period = 10000\n\n```\n\nYou may also activate the embedded debug extension. This will allow you to easily debug your MQTT WarpScript™ by printing messages on the standard output.\n\n```\n//\n// Load the debug extension. (usefull to have the STDOUT function)\n//\nwarpscript.extension.debug=io.warp10.script.ext.debug.DebugWarpScriptExtension\n```\n\nDon't forget to create the mqtt directory: `mkdir myWarp10path/mqtt`.\n\nRestart your Warp 10™ instance.\n\n\n# Your first MQTT WarpScript\n\nIn your `mqtt` directory, create a file named `test.mc2`. File must end with the `.mc2` extension, as any WarpScript™.\n\nThe file will contain WarpScript™ code which must leave a MAP on the stack. This map contains everything to configure the MQTT plugin. You can have as many WarpScript™ files as you want in your `mqtt` directory. They will be dynamically reloaded every (10s + mqtt timeout).\n\n\nExample for TheThingsNetwork mqtt:\n\n```\n// subscribe to the topics, attach a WarpScript™ macro callback to each message\n// the macro reads TheThingNetwork message to extract the first byte of payload,\n// the server timestamp, and the device id.\n\n'Loading MQTT TTN Warpscript™' STDOUT\n{\n  'host' 'eu.thethings.network'\n  'port' 1883\n  'user' 'senx-sensors'\n  'password' 'my application access key'\n  'clientid' 'Warp10'\n  'topics' [ \n    'senx-sensors/devices/senx-sensor1/up' \n    'senx-sensors/devices/senx-sensor2/up' \n    'senx-sensors/devices/senx-sensor3/up' \n  ]\n  'timeout' 20000\n  'parallelism' 1\n  'autoack' true\n\n  'macro' \n  \u003c% \n    //in case of timeout, the macro is called to flush buffers, if any, with NULL on the stack.\n    'message' STORE\n    \u003c% $message ISNULL ! %\u003e\n    \u003c%\n      $message MQTTPAYLOAD 'ascii' BYTES-\u003e JSON-\u003e 'TTNmessage' STORE\n      $TTNmessage 'metadata' GET 'time' GET TOTIMESTAMP 'ts' STORE\n      $TTNmessage 'dev_id' GET 'sensorID' STORE\n\n      $message MQTTTOPIC ' ' +\n        $sensorID + ' ' +\n        $ts ISO8601 + ' ' +\n        $TTNmessage TOSTRING +\n      STDOUT // print to warp10.log \n    %\u003e IFT\n  %\u003e\n}\n```\n\nMonitor your warp10.log to read standard output: `tail -F myWarp10path/logs/warp10.log`.\n\n# MAP detail\n\n- `host`, `port`, `user`, `password`, are similar to any MQTT client e.g mosquitto:\n\nmosquitto_sub -h `host` -p `port` -P `password` -u `user` -d -t 'senx-sensors/devices/senx-sensor1/up'\n\n- `timeout`: if there is no message received after timeout, the macro is called with NULL on the stack. It may help you to manage missing data or raise alerts.\n- `parallelism`: spawn multiple thread to handle heavy load.\n- `autoack`: you may choose to manually ACK the messages at the end of the macro. \n- `macro`: each time a message is received, this macro will be called with a message object on top of the stack.\n\n\n# New plugin functions\n\n- MQTTPAYLOAD : Consumes a mqtt message on top of the stack, returns a byte array with the message content on top of the stack.\n- MQTTTOPIC : Consumes a mqtt message on top of the stack, returns a string with the topic name of the message.\n- MQTTACK : Consumes a mqtt message on top of the stack. In non autoack mode, ack the mqtt message.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenx%2Fwarp10-plugin-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsenx%2Fwarp10-plugin-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenx%2Fwarp10-plugin-mqtt/lists"}