mqtt

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

README

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": "tibco-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) Init

func (t *MqttTrigger) Init(runner action.Runner)

Init implements ext.Trigger.Init

func (*MqttTrigger) Metadata

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

Metadata implements trigger.Trigger.Metadata

func (*MqttTrigger) RunAction

func (t *MqttTrigger) RunAction(handlerCfg *trigger.HandlerConfig, payload string)

RunAction starts a new Process Instance

func (*MqttTrigger) Start

func (t *MqttTrigger) Start() error

Start implements ext.Trigger.Start

func (*MqttTrigger) Stop

func (t *MqttTrigger) Stop() error

Stop implements ext.Trigger.Stop

type StartRequest

type StartRequest struct {
	ProcessURI  string                 `json:"flowUri"`
	Data        map[string]interface{} `json:"data"`
	Interceptor *support.Interceptor   `json:"interceptor"`
	Patch       *support.Patch         `json:"patch"`
	ReplyTo     string                 `json:"replyTo"`
}

StartRequest describes a request for starting a ProcessInstance

Jump to

Keyboard shortcuts

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