<p>A generiuc messaging trigger for <a href="https://github.com/fermyon/spin">Fermyon Spin</a>. Note this is an experimental/work-in-progress repo, and is not production ready at this point. Also - if you have suggestions for improvements, feel free to make them in the Issues tab.</p> <h2>Features</h2> <ul> <li>Use multipe message brokers, including (currently): <ul> <li>a simple in memory broker (with * based wildcard support)</li> <li>redis pubsub</li> <li>NATS</li> <li>MQTT</li> </ul> </li> <li>Named brokers - allowing multiple brokers of the same or different types in a single application <ul> <li>this is designed to support usecases such as separating the publishing of internal domain events &amp; public events meant for others to consume</li> </ul> </li> <li>an HTTP gateway server for publishing messages to the broker, as well as some request/response support</li> <li>a WebSocket server allowing subscribing to single subjects (with wildcard support, as available for the broker), as well as bi-directional socket communication</li> <li>Trigger a Spin component from a message on a subscribed channel</li> <li>Publish messages from the Spin component - defaulting to the same broker &amp; subject, but optionally setting other defaults or manually setting the broker &amp; subject for each message</li> <li>Run the HTTP gateway server independently of the main spin app (doesn’t really work for the in memory broker, but works for others)</li> <li>Multiple message paradigms - Pub/Sub, Request/Response &amp; Queues</li> </ul> <h2>Installation</h2> <p>To install the plugin, run the following command on the system running your spin deployment (or any development machine):</p> <pre><code class="language-bash">spin plugin install --url https://github.com/lee-orr/spin-message-trigger/releases/download/canary/trigger-message.json --yes </code></pre> <h2>Quick Start</h2> <p>Once you’ve installed the plugin, you can get started quickly installing the templates and using them:</p> <pre><code class="language-bash">spin templates install --git https://github.com/lee-orr/spin-message-trigger --upgrade </code></pre> <p>You can then set up a new project using:</p> <pre><code class="language-bash">spin new message-app </code></pre> <p>Once you have that, you can use <code>spin add</code> to set up components, brokers and gateways. Importantly <strong>Components must be manually added to the Cargo.toml workspace</strong> once they are created. The available templates are: | Template Name | Description | | — | — | | message-component | This creates a component that gets triggered by a subscription. | | request-response-message-component | This creates a component that gets triggered by a request-response message, with an HTTP method &amp; path. | | queue-component | This creates a component that gets subscribes to a queue - meaning only one member of the queue group will get triggered for each message. Most useful if you have multiple instances of the spin application running. | | | | | redis-broker | This connects to a redis pub-sub on the provided server | | mqtt-broker | This connects to an Mqtt server | | nats-broker | This connects to a Nats server or cluster | | | | | broker-gateway | This sets up an Http gateway that publishes to one of the brokers in your project |</p> <p>For detailed usage checkout out the <a href="https://github.com/lee-orr/spin-message-trigger">github repository</a></p>