package
0.0.0-20200821104852-f76c6d292a95
Repository: https://github.com/jvanderl/flogo-components.git
Documentation: pkg.go.dev

# README

Publish MQTT Message

This activity provides your flogo application the ability to publish a message on an MQTT topic.

Installation

flogo install github.com/jvanderl/flogo-components/incubator/activity/mqtt

Link for flogo web:

https://github.com/jvanderl/flogo-components/incubator/activity/mqtt

Schema

Inputs and Outputs:

{
  "input":[
   {
      "name": "broker",
      "type": "string",
      "required": true
    },
    {
      "name": "id",
      "type": "string"
    },
    {
      "name": "user",
      "type": "string"
    },
    {
      "name": "password",
      "type": "string"
    },
    {
      "name": "topic",
      "type": "string",
      "required": true
    },
    {
      "name": "qos",
      "type": "integer",
      "required": true,
      "allowed" : ["0", "1", "2"]
    },
    {
      "name": "message",
      "type": "any",
      "required": true
    }
  ],
  "output": [
    {
      "name": "result",
      "type": "string"
    }
  ]
}

Settings

SettingDescription
brokerthe MQTT Broker URI (tcp://[hostname]:[port])
idThe MQTT Client ID
userThe UserID used when connecting to the MQTT broker
passwordThe Password used when connecting to the MQTT broker
topicTopic on which the message is published
qosMQTT Quality of Service
messageThe message payload

Configuration Examples

Simple

Configure a task in flow to publish a "hello world" message on MQTT topic called "flogo":

{
  "id": 2,
  "name": "Publish MQTT Message",
  "type": 1,
  "activityType": "mqtt",
  "attributes": [
    {
      "name": "broker",
      "value": "tcp://localhost:1883",
      "type": "string"
    },
    {
      "name": "id",
      "value": "testmqtt",
      "type": "string"
    },
    {
      "name": "user",
      "value": "",
      "type": "string"
    },
    {
      "name": "password",
      "value": "",
      "type": "string"
    },
    {
      "name": "topic",
      "value": "flogo",
      "type": "string"
    },
    {
      "name": "qos",
      "value": "0",
      "type": "integer"
    },
    {
      "name": "message",
      "value": "Hello World",
      "type": "string"
    }
  ]
}

# Functions

NewActivity creates a new AppActivity.

# Structs

MyActivity is a stub for your Activity implementation.