sample

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

README

MQTT

This trigger allows you to listen to messages on MQTT.

Installation

Flogo CLI
flogo install github.com/qingcloudhx/edge-contrib/trigger/mqtt

Configuration

Settings:
Name Type Description
broker string The broker URL - REQUIRED
id string The id of client - REQUIRED
username string The user's name
password string The user's password
store string The store for message persistence
cleanSession bool Clean session flag
keepAlive int Keep Alive time in seconds
autoReconnect bool Enable Auto-Reconnect
sslConfig object SSL configuration
sslConfig Object:
Property Type Description
skipVerify bool Skip SSL validation, defaults to true
useSystemCert bool Use the systems root certificate file, defaults to true
caFile string The path to PEM encoded root certificates file
certFile string The path to PEM encoded client certificate
keyFile string The path to PEM encoded client key

Note: used if broker URI is ssl

Handler Settings
Name Type Description
topic array The topic to listen on - REQUIRED
replyTopic string The topic to reply on
qos int The Quality of Service
Output:
Name Type Description
message string The message recieved
Reply:
Name Type Description
data object The data recieved

Example

{
  "id": "mqtt-trigger",
  "name": "Mqtt Trigger",
  "ref": "github.com/qingcloudhx/edge-contrib/trigger/mqtt",
  "settings": {
      "broker" : "tcp://localhost:1883",
     	"id":"client-1"
  },
  "handlers": {
    "settings": {
    	"topic": "flogo",
    	"qos": "0"
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
}

func (*Factory) Metadata

func (f *Factory) Metadata() *trigger.Metadata

func (*Factory) New

func (*Factory) New(config *trigger.Config) (trigger.Trigger, error)

type HandlerSettings

type HandlerSettings struct {
	ASetting string `md:"aSetting,required"`
}

type Output

type Output struct {
	AnOutput string `md:"anOutput"`
}

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

type Reply

type Reply struct {
	AReply interface{} `md:"aReply"`
}

func (*Reply) FromMap

func (r *Reply) FromMap(values map[string]interface{}) error

func (*Reply) ToMap

func (r *Reply) ToMap() map[string]interface{}

type Settings

type Settings struct {
	ASetting int `md:"aSetting,required"`
}

type Trigger

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

func (*Trigger) Initialize

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

func (*Trigger) Metadata

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

Metadata implements trigger.Trigger.Metadata

func (*Trigger) Start

func (t *Trigger) Start() error

Start implements util.Managed.Start

func (*Trigger) Stop

func (t *Trigger) Stop() error

Stop implements util.Managed.Stop

Jump to

Keyboard shortcuts

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