mqtt

package
v2.0.0-dev.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetachConnection

func DetachConnection(clientId string, topic string)

func GetSource

func GetSource() api.BytesSource

Types

type AdConf

type AdConf struct {
	Tpc      string `json:"topic"`
	Qos      byte   `json:"qos"`
	Retained bool   `json:"retained"`

	ResendTopic string `json:"resendDestination"`
}

AdConf is the advanced configuration for the mqtt sink

type Conf

type Conf struct {
	Topic string `json:"datasource"`
	Qos   int    `json:"qos"`
}

type Connection

type Connection struct {
	pahoMqtt.Client
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(ctx api.StreamContext, selId string, props map[string]any) (*Connection, error)

CreateClient creates a new mqtt client. It is anonymous and does not require a name.

func GetConnection

func GetConnection(ctx api.StreamContext, props map[string]any) (*Connection, error)

func (*Connection) Close

func (conn *Connection) Close()

func (*Connection) GetClientId

func (conn *Connection) GetClientId() string

func (*Connection) Ping

func (conn *Connection) Ping() error

func (*Connection) Subscribe

func (conn *Connection) Subscribe(topic string, info *SubscriptionInfo) error

type ConnectionConfig

type ConnectionConfig struct {
	Server   string `json:"server"`
	PVersion string `json:"protocolVersion"`
	ClientId string `json:"clientid"`
	Uname    string `json:"username"`
	Password string `json:"password"`
	// contains filtered or unexported fields
}

type MQTTSink

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

func (*MQTTSink) Close

func (ms *MQTTSink) Close(ctx api.StreamContext) error

func (*MQTTSink) Collect

func (ms *MQTTSink) Collect(ctx api.StreamContext, item []byte) error

func (*MQTTSink) Connect

func (ms *MQTTSink) Connect(ctx api.StreamContext) error

func (*MQTTSink) Provision

func (ms *MQTTSink) Provision(_ api.StreamContext, ps map[string]any) error

type SourceConnector

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

SourceConnector is the connector for mqtt source When sharing the same connection, each topic will have one single sourceConnector as the shared source node

func (*SourceConnector) Close

func (ms *SourceConnector) Close(ctx api.StreamContext) error

func (*SourceConnector) Connect

func (ms *SourceConnector) Connect(ctx api.StreamContext) error

func (*SourceConnector) Ping

func (ms *SourceConnector) Ping(props map[string]interface{}) error

func (*SourceConnector) Provision

func (ms *SourceConnector) Provision(ctx api.StreamContext, props map[string]any) error

func (*SourceConnector) SetupStats

func (ms *SourceConnector) SetupStats(stats metric.StatManager)

func (*SourceConnector) Subscribe

func (ms *SourceConnector) Subscribe(ctx api.StreamContext, ingest api.BytesIngest, ingestError api.ErrorIngest) error

Subscribe is a one time only operation for source. It connects to the mqtt broker and subscribe to the topic Run open before subscribe

type SubscriptionInfo

type SubscriptionInfo struct {
	Qos        byte
	Handler    pahoMqtt.MessageHandler
	ErrHandler func(error)
}

Jump to

Keyboard shortcuts

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