messaging

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 8 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// ZeroMQ messaging implementation
	ZeroMQ = "zero"

	// MQTT messaging implementation
	MQTT = "mqtt"

	// Redis Pub/Sub messaging implementation
	Redis = "redis"

	// NatsCore implementation
	NatsCore = "nats-core"

	// NatsJetStream implementation
	NatsJetStream = "nats-jetstream"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageClient

type MessageClient interface {
	// Connect to messaging host specified in MessageBus config
	// returns error if not able to connect
	Connect() error

	// Publish is to send message to the message bus
	// the message contains data payload to send to the message queue
	Publish(message types.MessageEnvelope, topic string) error

	// Subscribe is to receive messages from topic channels
	// if message does not require a topic, then use empty string ("") for topic
	// the topic channel contains subscribed message channel and topic to associate with it
	// the channel is used for multiple threads of subscribers for 1 publisher (1-to-many)
	// the messageErrors channel returns the message errors from the caller
	// since subscriber works in asynchronous fashion
	// the function returns error for any subscribe error
	Subscribe(topics []types.TopicChannel, messageErrors chan error) error

	// Disconnect is to close all connections on the message bus
	// and TopicChannel will also be closed
	Disconnect() error
}

MessageClient is the messaging interface for publisher-subscriber pattern

func NewMessageClient

func NewMessageClient(msgConfig types.MessageBusConfig) (MessageClient, error)

NewMessageClient is a factory function to instantiate different message client depending on the "Type" from the configuration

Directories

Path Synopsis
Package mqtt provides additional functionality to aid in configuring a MQTT client.
Package mqtt provides additional functionality to aid in configuring a MQTT client.

Jump to

Keyboard shortcuts

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