natsqueue

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(url string, opts ...queue.Option) (*queue.Queue, error)

New creates a high-level Queue using the NATS backend. @group Constructors

Example: nats shorthand constructor

q, err := natsqueue.New(
	"nats://127.0.0.1:4222",
	queue.WithWorkers(4), // optional; default: runtime.NumCPU() (min 1)
)
if err != nil {
	return
}
_ = q

func NewWithConfig

func NewWithConfig(cfg Config, opts ...queue.Option) (*queue.Queue, error)

NewWithConfig creates a high-level Queue using an explicit NATS driver config. @group Constructors

Example: nats config constructor

q, err := natsqueue.NewWithConfig(
	natsqueue.Config{
		DriverBaseConfig: queueconfig.DriverBaseConfig{
			DefaultQueue: "critical", // default if empty: "default"
			Observer:     nil,        // default: nil
		},
		URL: "nats://127.0.0.1:4222", // required
	},
	queue.WithWorkers(4), // optional; default: runtime.NumCPU() (min 1)
)
if err != nil {
	return
}
_ = q

Types

type Config

type Config struct {
	queueconfig.DriverBaseConfig
	URL string
}

Config configures the NATS driver module constructor.

Jump to

Keyboard shortcuts

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