nats

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker is a nats-jetstream based broker implementation.

func New

func New(cfg Options, lo *slog.Logger) (*Broker, error)

New() returns a new instance of nats-jetstream broker.

func (*Broker) Consume

func (b *Broker) Consume(ctx context.Context, work chan []byte, queue string)

func (*Broker) Enqueue

func (b *Broker) Enqueue(_ context.Context, msg []byte, queue string) error

func (*Broker) EnqueueScheduled

func (b *Broker) EnqueueScheduled(ctx context.Context, msg []byte, queue string, ts time.Time) error

func (*Broker) GetPending

func (b *Broker) GetPending(ctx context.Context, queue string) ([]string, error)

type Options

type Options struct {
	URL         string
	EnabledAuth bool
	Username    string
	Password    string

	// Stream -> Subjects map
	Streams map[string][]string
}

Jump to

Keyboard shortcuts

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