nats

package
v0.0.0-...-5032473 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 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 Config

type Config struct {
	Sockets       []string `validate:"required"`
	IsHeadlessSvc bool
	Stream        string

	Subject  string
	Subjects map[string]string
	Durable  string

	Retention
	Fetch
}

type Fetch

type Fetch struct {
	Interval time.Duration
	Number   int
	Retry    int
}

type Helper

type Helper struct {
	JsClient     JetStreamClient
	JsSubscriber JetStreamSubscriber

	Config
}

func (*Helper) AddStream

func (h *Helper) AddStream(stream string) error

func (*Helper) Publish

func (h *Helper) Publish(subject string, msg []byte) error

func (*Helper) PullSubscribe

func (h *Helper) PullSubscribe(subject string) ([][]byte, error)

func (*Helper) SetJetStreamSubscriber

func (h *Helper) SetJetStreamSubscriber(subject string, durable string)

func (*Helper) SetNatsJetStreamClient

func (h *Helper) SetNatsJetStreamClient()

type JetStreamClient

type JetStreamClient interface {
	StreamInfo(stream string, opts ...nats.JSOpt) (*nats.StreamInfo, error)
	AddStream(*nats.StreamConfig, ...nats.JSOpt) (*nats.StreamInfo, error)
	Publish(string, []byte, ...nats.PubOpt) (*nats.PubAck, error)
	PullSubscribe(string, string, ...nats.SubOpt) (*nats.Subscription, error)
}

type JetStreamSubscriber

type JetStreamSubscriber interface {
	Fetch(batch int, opts ...nats.PullOpt) ([]*nats.Msg, error)
}

type Retention

type Retention struct {
	Second int
	Size   int
}

Jump to

Keyboard shortcuts

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