nats

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrConnectCode        = "11000"
	ErrEncodedConnCode    = "11000"
	ErrPublishCode        = "11001"
	ErrPublishRequestCode = "11001"
	ErrQueueSubscribeCode = "11001"
)

Variables

This section is empty.

Functions

func ErrConnect

func ErrConnect(err error) error

func ErrEncodedConn

func ErrEncodedConn(err error) error

func ErrPublish

func ErrPublish(err error) error

func ErrPublishRequest

func ErrPublishRequest(err error) error

func ErrQueueSubscribe

func ErrQueueSubscribe(err error) error

func New

func New(opts Options) (broker.Handler, error)

New - constructor

Types

type Nats

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

Nats will implement Nats subscribe and publish functionality

func (*Nats) Info

func (n *Nats) Info() string

func (*Nats) Publish

func (n *Nats) Publish(subject string, message *broker.Message) error

Publish - to publish messages

func (*Nats) PublishWithChannel

func (n *Nats) PublishWithChannel(subject string, msgch chan *broker.Message) error

PublishWithChannel - to publish messages with channel

func (*Nats) Subscribe

func (n *Nats) Subscribe(subject, queue string, message []byte) error

Subscribe - for subscribing messages TODO Ques: Do we want to unsubscribe TODO will the method-user just subsribe, how will it handle the received messages?

func (*Nats) SubscribeWithChannel

func (n *Nats) SubscribeWithChannel(subject, queue string, msgch chan *broker.Message) error

SubscribeWithChannel will publish all the messages received to the given channel

type Options

type Options struct {
	URLS           []string
	ConnectionName string
	Username       string
	Password       string
	ReconnectWait  time.Duration
	MaxReconnect   int
}

Jump to

Keyboard shortcuts

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