topics

package
v0.0.0-...-2214204 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package topics deals with MQTT topic names, topic filters and subscriptions.

  • "Topic name" is a / separated string that could contain #, * and $
  • / in topic name separates the string into "topic levels"
  • # is a multi-level wildcard, and it must be the last character in the topic name. It represents the parent and all children levels.
  • + is a single level wildwcard. It must be the only character in the topic level. It represents all names in the current level.
  • $ is a special character that says the topic is a system level topic

Index

Constants

View Source
const (
	// MWC is the multi-level wildcard
	MWC = "#"

	// SWC is the single level wildcard
	SWC = "+"
)

Variables

This section is empty.

Functions

func Register

func Register(name string, provider Provider)

Register topic provider

func UnRegister

func UnRegister(name string)

UnRegister topic provider

Types

type Config

type Config struct {
	Name    string
	Stat    systree.TopicsStat
	Persist persistenceTypes.Retained
}

Config of topics manager

type Manager

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

Manager of topics

func NewManager

func NewManager(config Config) (*Manager, error)

NewManager add new manager

func (*Manager) Close

func (m *Manager) Close() error

Close manager

func (*Manager) Publish

func (m *Manager) Publish(msg *message.PublishMessage) error

Publish message

func (*Manager) Retain

func (m *Manager) Retain(msg *message.PublishMessage) error

Retain messages

func (*Manager) Retained

func (m *Manager) Retained(topic string, msgs *[]*message.PublishMessage) error

Retained messages

func (*Manager) Subscribe

func (m *Manager) Subscribe(topic string, qos message.QosType, subscriber *types.Subscriber) (message.QosType, error)

Subscribe to topic

func (*Manager) UnSubscribe

func (m *Manager) UnSubscribe(topic string, subscriber *types.Subscriber) error

UnSubscribe from topic

type Provider

type Provider interface {
	Configure(stat systree.TopicsStat, persist persistenceTypes.Retained) error
	Subscribe(topic string, qos message.QosType, subscriber *types.Subscriber) (message.QosType, error)
	UnSubscribe(topic string, subscriber *types.Subscriber) error
	Publish(msg *message.PublishMessage) error
	Retain(msg *message.PublishMessage) error
	Retained(topic string, msgs *[]*message.PublishMessage) error
	Close() error
}

Provider interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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