nats

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package nats hold the implementation of the Publisher and PubSub interfaces for the NATS messaging system, the internal messaging broker of the Mainflux IoT platform. Due to the practical requirements implementation Publisher is created alongside PubSub. The reason for this is that Subscriber implementation of NATS brings the burden of additional struct fields which are not used by Publisher. Subscriber is not implemented separately because PubSub can be used where Subscriber is needed.

Index

Constants

View Source
const SubjectAllChannels = "channels.>"

SubjectAllChannels represents subject to subscribe for all the channels.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub interface {
	messaging.PubSub
	Close()
}

PubSub wraps messaging Publisher exposing Close() method for NATS connection.

func NewPubSub

func NewPubSub(url, queue string, logger log.Logger) (PubSub, error)

NewPubSub returns NATS message publisher/subscriber. Parameter queue specifies the queue for the Subscribe method. If queue is specified (is not an empty string), Subscribe method will execute NATS QueueSubscribe which is conceptually different from ordinary subscribe. For more information, please take a look here: https://docs.nats.io/developing-with-nats/receiving/queues. If the queue is empty, Subscribe will be used.

type Publisher

type Publisher interface {
	messaging.Publisher
	Close()
}

Publisher wraps messaging Publisher exposing Close() method for NATS connection.

func NewPublisher

func NewPublisher(url string) (Publisher, error)

NewPublisher returns NATS message Publisher.

Jump to

Keyboard shortcuts

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