bridge

package
v0.0.0-...-9286cc4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 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"
)
View Source
const (
	//Kafka plugin name
	Kafka  = "kafka"
	CSVLog = "csvlog"
)

Variables

This section is empty.

Functions

func InitCSVLog

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

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   string `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