jetstream

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Readme added in v0.17.0

func Readme() string

Types

type MarshalFn added in v0.3.2

type MarshalFn func(v interface{}) ([]byte, error)

type Option

type Option func(*Stream)

func WithConfig

func WithConfig(v *nats.StreamConfig, opts ...nats.JSOpt) Option

func WithJSOptions added in v0.14.1

func WithJSOptions(v ...nats.JSOpt) Option

WithJSOptions option

func WithNamespace

func WithNamespace(v string) Option

WithNamespace option

func WithNatsOptions

func WithNatsOptions(v ...nats.Option) Option

WithNatsOptions option

func WithReconnectFailedHandler added in v0.5.5

func WithReconnectFailedHandler(v func(error)) Option

WithReconnectFailedHandler option

func WithReconnectMaxRetries added in v0.5.5

func WithReconnectMaxRetries(v int) Option

WithReconnectMaxRetries option

func WithReconnectTimeout added in v0.5.5

func WithReconnectTimeout(v time.Duration) Option

WithReconnectTimeout option

type Publisher

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

func (*Publisher) JS

func (s *Publisher) JS() nats.JetStreamContext

func (*Publisher) Marshal added in v0.3.2

func (s *Publisher) Marshal(v interface{}) ([]byte, error)

func (*Publisher) NewMsg

func (s *Publisher) NewMsg(v interface{}) (*nats.Msg, error)

func (*Publisher) PubOpts

func (s *Publisher) PubOpts(opts ...nats.PubOpt) []nats.PubOpt

func (*Publisher) PublishMsg

func (s *Publisher) PublishMsg(data interface{}, opts ...nats.PubOpt) (*nats.PubAck, error)

func (*Publisher) PublishMsgAsync

func (s *Publisher) PublishMsgAsync(data interface{}, opts ...nats.PubOpt) (nats.PubAckFuture, error)

func (*Publisher) Subject

func (s *Publisher) Subject() string

type PublisherOption

type PublisherOption func(*Publisher)

func PublisherWithHeader

func PublisherWithHeader(v nats.Header) PublisherOption

func PublisherWithMarshal added in v0.3.2

func PublisherWithMarshal(marshal MarshalFn) PublisherOption

func PublisherWithPubOpts

func PublisherWithPubOpts(v ...nats.PubOpt) PublisherOption

type Stream

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

func New

func New(l *zap.Logger, name, addr string, opts ...Option) (*Stream, error)

func (*Stream) Addr added in v0.6.2

func (s *Stream) Addr() string

func (*Stream) Close added in v0.9.11

func (s *Stream) Close()

func (*Stream) Conn

func (s *Stream) Conn() *nats.Conn

func (*Stream) Info

func (s *Stream) Info() *nats.StreamInfo

func (*Stream) JS

func (s *Stream) JS() nats.JetStreamContext

func (*Stream) Name

func (s *Stream) Name() string

func (*Stream) Publisher

func (s *Stream) Publisher(subject string, opts ...PublisherOption) *Publisher

func (*Stream) Subscriber

func (s *Stream) Subscriber(subject string, opts ...SubscriberOption) *Subscriber

type Subscriber

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

func (*Subscriber) ChanSubscribe added in v0.9.10

func (s *Subscriber) ChanSubscribe(ch chan *nats.Msg, opts ...nats.SubOpt) (*nats.Subscription, error)

func (*Subscriber) JS

func (s *Subscriber) JS() nats.JetStreamContext

func (*Subscriber) QueueSubscribe

func (s *Subscriber) QueueSubscribe(queue string, handler stream.MsgHandler, opts ...nats.SubOpt) (*nats.Subscription, error)

func (*Subscriber) SubOpts

func (s *Subscriber) SubOpts(opts ...nats.SubOpt) []nats.SubOpt

func (*Subscriber) Subject

func (s *Subscriber) Subject() string

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(handler stream.MsgHandler, opts ...nats.SubOpt) (*nats.Subscription, error)

func (*Subscriber) Unmarshal added in v0.3.2

func (s *Subscriber) Unmarshal(msg *nats.Msg, v interface{}) error

type SubscriberOption

type SubscriberOption func(*Subscriber)

func SubscriberWithNamespace

func SubscriberWithNamespace(v string) SubscriberOption

func SubscriberWithSubOpts

func SubscriberWithSubOpts(v ...nats.SubOpt) SubscriberOption

func SubscriberWithUnmarshal added in v0.3.2

func SubscriberWithUnmarshal(unmarshal UnmarshalFn) SubscriberOption

type UnmarshalFn added in v0.3.2

type UnmarshalFn func(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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