bridge

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Connect mqtt connect
	Connect = "connect"
	//Publish mqtt publish
	Publish = "publish"
	//Subscribe mqtt sub
	Subscribe = "subscribe"
	//Unsubscribe mqtt sub
	Unsubscribe = "unsubscribe"
	//Disconnect mqtt disconenct
	Disconnect = "disconnect"
	PingReq    = "ping"
)
View Source
const (
	//Kafka plugin name
	Kafka  = "kafka"
	CSVLog = "csvlog"
)

Variables

This section is empty.

Functions

func InitCSVLog added in v0.0.8

func InitCSVLog() *csvLog

InitCSVLog initialises a CSVLOG plugin It does this by loading a config file if one can be found. The default filename follows the same convention as the kafka plugin - ie it's in "./plugins/csvlog/csvlogconfig.json" but an environment var - CSVLOGCONFFILE - can be set to provide a different location.

Once the config is set the worker is started

func InitKafka

func InitKafka() *kafka

InitKafka Init kafka client

func LoadCSVLogConfig added in v0.0.8

func LoadCSVLogConfig() csvBridgeConfig

LoadCSVLogConfig loads the configuration file - it currently looks in "./plugins/csvlog/csvlogconfig.json" (following the example of the default location of the kafka plugin config file) if it doesn't find it there it looks in two further places - the current directory and an "assets" folder under the current directory (This is for compatibility with a couple of deployed) implementations.

Types

type BridgeMQ

type BridgeMQ interface {
	// Publish return true to cost the message
	Publish(e *Elements) (bool, error)
}

func NewBridgeMQ

func NewBridgeMQ(name string) BridgeMQ

type Elements

type Elements struct {
	ClientID  string `json:"clientid"`
	Username  string `json:"username"`
	Topic     string `json:"topic"`
	Payload   []byte `json:"payload"`
	Timestamp int64  `json:"ts"`
	Size      int32  `json:"size"`
	Action    string `json:"action"`
}

Elements kafka publish elements

Jump to

Keyboard shortcuts

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