config

package
v0.0.0-...-b72f9b1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ResponseTopicStart prepent to request reply topic to get the response topic
	ResponseTopicStart = "mqtt-bridge-response/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channels

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

Channels type to store all channels

func NewChannels

func NewChannels(basename string) Channels

NewChannels function to create a new channel managment

func (*Channels) Get

func (c *Channels) Get(topic string) []string

Get function to get all registered nats subjects for a specific MQTT topic

func (*Channels) GetTopic

func (c *Channels) GetTopic(subject string) (string, error)

GetTopic function to get the corresponding MQTT topic to a nats subscription

func (*Channels) RegisterSub

func (c *Channels) RegisterSub(topic string) (string, error)

RegisterSub function to register to a MQTT topic to get a mapped nats subject

func (*Channels) UnregisterSub

func (c *Channels) UnregisterSub(subject string) (string, error)

UnregisterSub function to unregister a specific nats subject

type Config

type Config struct {
	MessageChannelsMutex sync.Mutex
	MessageChannels      map[string][]subjectChannelMapping

	RequestResponseMutex sync.Mutex
	RequestResponse      map[string]chan []byte
	// contains filtered or unexported fields
}

Config type to store configuration

func NewConfig

func NewConfig(basename string, natsConn *nats.Conn, newConfigRegisterChan, newConfigUnregisterChan chan string, pubChan chan paho.Publish) *Config

NewConfig creates a new config containing all channel definitions

func (*Config) GetChannelsForTopic

func (c *Config) GetChannelsForTopic(topic string) map[string]chan []byte

GetChannelsForTopic returns all go channels that feed the handling routines of all nats subscriptions for a given topic

func (*Config) GetRegistrations

func (c *Config) GetRegistrations(topic string) []string

GetRegistrations gets all client registrations for a specific topic

func (*Config) HandleConfigRequests

func (c *Config) HandleConfigRequests()

HandleConfigRequests registeres for configuration requests on the nats server

func (*Config) HandlePublishRequests

func (c *Config) HandlePublishRequests()

HandlePublishRequests register handler for publish requests on the nats server

func (*Config) HandleRequestResponse

func (c *Config) HandleRequestResponse()

HandleRequestResponse register handler for request response on the nats server

type RegisterHandlerConfig

type RegisterHandlerConfig struct {
	Topic       string
	HandlerFunc paho.MessageHandler
}

RegisterHandlerConfig config for registering handler for MQTT topic

Jump to

Keyboard shortcuts

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