nats

package
v0.0.0-...-31f5ead Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn = nats.Conn

Conn is a NATS connection

type Transport

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

Transport object

func New

func New(options ...transport.Option) *Transport

New returns client for NATS messaging

func (*Transport) Close

func (t *Transport) Close()

Close connection

func (*Transport) Handle

func (t *Transport) Handle(path string, group string, handler func([]byte, func([]byte))) error

Handle path

func (*Transport) IsOpen

func (t *Transport) IsOpen() bool

IsOpen returns wether the nats connection is open and ready to be used.

func (*Transport) Listen

func (t *Transport) Listen(callback func())

Listen to nats

func (*Transport) OnClose

func (t *Transport) OnClose(handler interface{})

OnClose adds a handler to NATS close event

func (*Transport) Publish

func (t *Transport) Publish(topic string, data []byte) error

Publish to topic

func (*Transport) Request

func (t *Transport) Request(path string, payload []byte, timeOut int) ([]byte, error)

Request path

func (*Transport) Subscribe

func (t *Transport) Subscribe(topic string, group string, handler func([]byte)) error

Subscribe for topic

func (*Transport) SubscribeForRawMsg

func (t *Transport) SubscribeForRawMsg(topic string, group string, handler func(interface{})) error

SubscribeForRawMsg for topic

Jump to

Keyboard shortcuts

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