transport

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRequestTimeout = time.Second * 15
)

Variables

View Source
var (
	DefaultTransport = NewTransport()
)

Functions

func NewTransport

func NewTransport(opts ...Option) *transport

Types

type Option

type Option func(*Options)

func Addrs

func Addrs(addrs ...string) Option

Addrs to use for transport

func Subject

func Subject(sub string) Option

subject to use for transport

func Timeout

func Timeout(t time.Duration) Option

Timeout sets the timeout for Send/Recv execution

type Options

type Options struct {
	Subject string        // Message destination address
	Addrs   []string      // A configured set of nats servers which this client will use when attempting to connect.
	Timeout time.Duration // Dialer timeout
}

type ResponseHandler

type ResponseHandler func([]byte) error

type Transport

type Transport interface {
	Options() Options
	Init() error
	Request(string, []byte, ResponseHandler) error
	Publish(string, []byte) error
	Subscribe() error
	SetHandler(nats.MsgHandler)
	SendFile(*codec.Message, string, []byte) error
	Close() error
}

Jump to

Keyboard shortcuts

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