{"id":28776155,"url":"https://github.com/spinframework/spin-trigger-mqtt","last_synced_at":"2026-04-14T23:03:19.107Z","repository":{"id":225882138,"uuid":"701296164","full_name":"spinframework/spin-trigger-mqtt","owner":"spinframework","description":"An MQTT trigger for Spin","archived":false,"fork":false,"pushed_at":"2025-08-29T01:02:46.000Z","size":37870,"stargazers_count":20,"open_issues_count":4,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-11T15:28:04.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spinframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-06T10:47:59.000Z","updated_at":"2025-08-29T00:31:47.000Z","dependencies_parsed_at":"2024-06-04T15:53:19.255Z","dependency_job_id":"0a24fe68-1fb2-412b-9383-190d43d0c322","html_url":"https://github.com/spinframework/spin-trigger-mqtt","commit_stats":null,"previous_names":["suneetnangia/spin-mqtt-trigger-sdk","spinkube/spin-mqtt-trigger-sdk","spinkube/spin-trigger-mqtt","spinframework/spin-trigger-mqtt"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/spinframework/spin-trigger-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spinframework","download_url":"https://codeload.github.com/spinframework/spin-trigger-mqtt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279104410,"owners_count":26104504,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-17T15:06:43.090Z","updated_at":"2025-10-15T19:10:20.010Z","avatar_url":"https://github.com/spinframework.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An MQTT Trigger/Plugin for Fermyon Spin Framework\n\nMQTT is a dominant communication protocol in IoT and edge scenarios, used by major products and services in manufacturing, automotive and other industries.\nObjective of this repo is to provide a robust plugin/trigger to receive MQTT messages in the Spin based wasm components.\n\n## Usage Guidance\n\nThis plugin is a trigger plugin i.e. it is activated when message is received on a configured MQTT topic.\nThe plugin then instantiates a Wasm component and injects the message to the component, which in turn process the message and can optionally publish the messages to any of the available targets in Spin e.g. MQTT, Redis, Http endpoints.\n\n### Install Plugin\n\nInstall MQTT Plugin:\n\n```bash\nspin plugin install --url https://github.com/spinframework/spin-trigger-mqtt/releases/download/canary/trigger-mqtt.json --yes\n```\n\n[Note: release management for multiple versions of this plugin/trigger will be added soon]\n\nIf you want to learn more about Spin's plugin model, read [here](https://www.fermyon.com/blog/managing-spin-templates-and-plugins).\n\n### Install Template\n\n[Spin templates](https://www.fermyon.com/blog/managing-spin-templates-and-plugins) allow a Spin developer to quickly create the skeleton of an application or component, ready for the application logic to be filled in. As part of this repo, a new template is created to help build applications which make use of MQTT as a communication protocol/trigger.\n\nInstall MQTT Template:\n\n```bash\nspin templates install --git https://github.com/spinframework/spin-trigger-mqtt --upgrade\n```\n\n### Create Spin App\n\n```bash\nspin new -t mqtt-rust mqtt-app\n```\n\n## Templating `mqtt` Configuration in `spin.toml`\n\nThe `address`, `username`, `password` and `topic` support the ability to be configured using Spin variables. An example of configuring the password using env variables:\n\n```toml\n#spin.toml\nspin_manifest_version = 2\n\n[application]\nname = \"mqtt-app\"\nversion = \"0.1.0\"\ndescription = \"Demo app to receive MQTT messages.\"\nauthors = [\"Suneet Nangia \u003csuneetnangia@gmail.com\u003e\"]\n\n[variables]\npassword = { required = true }\n\n[application.trigger.mqtt]\naddress = \"mqtt://localhost:1883\"\nusername = \"user\"\npassword = \"{{ password }}\"\nkeep_alive_interval = \"30\"\n...\n```\n\nTo inject the Spin variable using environment variables:\n\n```bash\nSPIN_VARIABLE_PASSWORD=password spin up\n```\n\nTo skip authentication, set the `username` and `password` fields to empty strings:\n\n```toml\n[application.trigger.mqtt]\naddress = \"mqtt://localhost:1883\"\nusername = \"admin\"\npassword = \"public\"\nkeep_alive_interval = \"30\"\n```\n\n## State of Play\n\n1. Authenticates using anonymous and username/password to MQTT server.\n2. Receive messages from an MQTT topic per configured QoS.\n\n[more MQTT client/subscription attributes will be available soon]\n\n## Running an MQTT Broker\n\nDownload [MQTTX CLI](https://github.com/emqx/MQTTX/tree/main/cli)\n\n```sh\nbrew install emqx/mqttx/mqttx-cli\n```\n\nRun the EMQX broker: https://mqttx.app/docs/get-started\n\n```sh\ndocker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx\n```\n\nThe default username and password of the broker is `admin` and `public`.\n\n\u003e Alternatively, use [Mosquitto's public MQTT broker](https://test.mosquitto.org/) without authentication by setting the broker hostname to `test.mosquitto.org`.\n\n## Dev Loop [Build and Install from Source]\n\nFor this simple dev loop, make sure you have access to an MQTT broker. The following steps assume you followed the section to [run an MQTT broker locally](#running-an-mqtt-broker).\n\n* Open the repo in Dev Container or in pre-configured GitHub [Codespace](https://codespaces.new/spinframework/spin-trigger-mqtt)\n* Run ```make``` to build and install the plugin locally.\n* Update ```examples/mqtt-app/spin.toml``` to reflect your MQTT server details and ensure it's accessible on the network.\n* Run ```spin build --up --from examples/mqtt-app/spin.toml``` to run the example Spin app.\n* Run ```mqttx pub -t 'messages-in01' -h 'localhost' -p 1883 -u 'admin' -P 'public' -m 'Hello to  MQTT Spin Component!'``` with the hostname and credentials for your server, to publish the message which is then received by Spin app.\n* Optionally, run ```make clean``` to clean up and rebuild and install the plugin locally.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinframework%2Fspin-trigger-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspinframework%2Fspin-trigger-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinframework%2Fspin-trigger-mqtt/lists"}