mqtt

package
v0.5.7-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2018 License: BSD-3-Clause Imports: 8 Imported by: 1

README


title: MQTT weight: 4705

tibco-mqtt

This trigger provides your flogo application the ability to start a flow via MQTT

Installation

flogo install github.com/TIBCOSoftware/flogo-contrib/trigger/mqtt

Schema

Settings, Outputs and Endpoint:

{
  "settings":[
      {
        "name": "broker",
        "type": "string"
      },
      {
        "name": "id",
        "type": "string"
      },
      {
        "name": "user",
        "type": "string"
      },
      {
        "name": "password",
        "type": "string"
      },
      {
        "name": "store",
        "type": "string"
      },
      {
        "name": "topic",
        "type": "string"
      },
      {
        "name": "qos",
        "type": "number"
      },
      {
        "name": "cleansess",
        "type": "boolean"
      }
    ],
    "endpoint": {
      "settings": [
        {
          "name": "topic",
          "type": "string"
        }
      ]
    }
}

Example Configurations

Triggers are configured via the triggers.json of your application. The following are some example configuration of the MQTT Trigger.

Start a flow

Configure the Trigger to start "myflow". "settings" "topic" is the topic it uses to listen for incoming messages. So in this case the "endpoints" "settings" "topic" is "test_start" will start "myflow" flow. The incoming message payload has to define "replyTo" which is the the topic used to reply on.

{
  "triggers": [
    {
      "name": "flogo-mqtt",
      "settings": {
        "topic": "flogo/#",
        "broker": "tcp://192.168.1.12:1883",
        "id": "flogo",
        "user": "",
        "password": "",
        "store": "",
        "qos": "0",
        "cleansess": "false"
      },
      "endpoints": [
        {
          "actionType": "flow",
          "actionURI": "embedded://myflow",
          "settings": {
            "topic": "test_start"
          }
        }
      ]
    }
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(md *trigger.Metadata) trigger.Factory

NewFactory create a new Trigger factory

Types

type MQTTFactory

type MQTTFactory struct {
	// contains filtered or unexported fields
}

MQTTFactory MQTT Trigger factory

func (*MQTTFactory) New

func (t *MQTTFactory) New(config *trigger.Config) trigger.Trigger

New Creates a new trigger instance for a given id

type MqttTrigger

type MqttTrigger struct {
	// contains filtered or unexported fields
}

MqttTrigger is simple MQTT trigger

func (*MqttTrigger) Initialize added in v0.5.2

func (t *MqttTrigger) Initialize(ctx trigger.InitContext) error

Initialize implements trigger.Initializable.Initialize

func (*MqttTrigger) Metadata

func (t *MqttTrigger) Metadata() *trigger.Metadata

Metadata implements trigger.Trigger.Metadata

func (*MqttTrigger) RunHandler added in v0.5.2

func (t *MqttTrigger) RunHandler(handler *trigger.Handler, payload string)

RunHandler runs the handler and associated action

func (*MqttTrigger) Start

func (t *MqttTrigger) Start() error

Start implements trigger.Trigger.Start

func (*MqttTrigger) Stop

func (t *MqttTrigger) Stop() error

Stop implements ext.Trigger.Stop

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL