@runnerty/executor-mqtt

3.0.2 • Public • Published

Smart Processes Management

NPM version Downloads Dependency Status code style: prettier

Executor for Runnerty: MQTT

Module MQTT Publisher. This is a wrapper from the MQTT.js

Installation:

Through NPM

npm i @runnerty/executor-mqtt

You can also add modules to your project with runnerty-cli

npx runnerty-cli add @runnerty/executor-mqtt

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty-cli globally you can include the module with this command:

rty add @runnerty/executor-mqtt

Configuration:

Add in config.json:

Simple:
{
  "id": "mqtt_default",
  "type": "@runnerty-executor-mqtt",
  "hostname": "localhost"
}
All parameters:
{
  "id": "mqtt_default",
  "type": "@runnerty-executor-mqtt",
  "protocol": "mqtt",
  "hostname": "localhost",
  "port": 1883,
  "username": "guest",
  "password": "pass",
  "keepalive": 60,
  "reschedulePings": true,
  "clientId": "mqttjs_@RANDOM(0, 1024, 1024)",
  "protocolId": "MQTT",
  "protocolVersion": 4,
  "clean": true,
  "reconnectPeriod": 1000,
  "connectTimeout": 30000,
  "queueQoSZero": true,
  "tlsKeyFile": "./my_cert.key",
  "tlsCertFile": "./my_cert.cert",
  "tlsCAFile": "./my_cert.ca",
  "rejectUnauthorized": false,
  "properties": {
    "sessionExpiryInterval": 3600,
    "receiveMaximum": 1024,
    "maximumPacketSize": 32,
    "topicAliasMaximum": 32,
    "requestResponseInformation": true,
    "userProperties": {
      "some": "value"
    },
    "authenticationMethod": "auth_method",
    "authPacket": {
      "some": "value"
    },
    "resubscribe": true
  }
}

Plan sample:

Add in plan.json:

Simple:
{
  "id": "mqtt_default",
  "topic": "MY_TOPIC",
  "message": "My message from Runnerty!"
}
All parameters:
{
  "id": "mqtt_default",
  "topic": "MY_TOPIC",
  "message": "My message from Runnerty!",
  "options": {
    "qos": 0,
    "retain": false,
    "dup": false,
    "properties": {
      "payloadFormatIndicator": true,
      "messageExpiryInterval": 60,
      "topicAlias": 1,
      "responseTopic": "res_topic",
      "userProperties": {
        "some": "value"
      },
      "subscriptionIdentifier": 1234,
      "contentType": "contenttype_value"
    }
  }
}

More information in MQTT api reference

Output (Process values):

  • PROCESS_EXEC_ERR_OUTPUT: Error output message.

Readme

Keywords

Package Sidebar

Install

npm i @runnerty/executor-mqtt

Weekly Downloads

6

Version

3.0.2

License

MIT

Unpacked Size

14.2 kB

Total Files

11

Last publish

Collaborators

  • coderty