nats

package
v0.7.54 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrConnectCode        = "meshkit-11118"
	ErrEncodedConnCode    = "meshkit-11119"
	ErrPublishCode        = "meshkit-11120"
	ErrPublishRequestCode = "meshkit-11121"
	ErrQueueSubscribeCode = "meshkit-11122"
)

Variables

View Source
var (
	NewEmptyConnection = &Nats{}
)

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) CloseConnection added in v0.5.2

func (n *Nats) CloseConnection()

func (*Nats) ConnectedEndpoints added in v0.5.18

func (n *Nats) ConnectedEndpoints() (endpoints []string)

func (*Nats) DeepCopy added in v0.2.17

func (in *Nats) DeepCopy() *Nats

DeepCopy is a deepcopy function, copying the receiver, creating a new Nats.

func (*Nats) DeepCopyInto added in v0.2.17

func (in *Nats) DeepCopyInto(out broker.Handler)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Nats) DeepCopyObject added in v0.2.17

func (in *Nats) DeepCopyObject() broker.Handler

DeepCopyObject is a deepcopy function, copying the receiver, creating a new broker.Handler.

func (*Nats) Info

func (n *Nats) Info() string

func (*Nats) IsEmpty added in v0.2.17

func (in *Nats) IsEmpty() bool

Check if the connection object is empty

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