nats

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package nats is the embedded-NATS driver for the bus.Bus port (ADR-0008): an in-process nats-server with JetStream (memory or file storage), all pure-Go (no cgo). It lives in its own package so nats stays out of the driver-dep-free port (internal/bus). The raw JetStream API is never exposed beyond this driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, opts Options) (bus.Bus, error)

Open starts an in-process nats-server (JetStream enabled) and returns the bus.

Open(ctx, Options{Storage: MemoryStorage})              → in-memory (tests / InMemory())
Open(ctx, Options{Storage: FileStorage, StoreDir: dir}) → durable (production)

Types

type Options

type Options struct {
	Storage  Storage
	StoreDir string // required for FileStorage
}

Options configures the embedded server.

type Storage

type Storage int

Storage selects the JetStream backend for streams created on this bus.

const (
	MemoryStorage Storage = iota
	FileStorage
)

Jump to

Keyboard shortcuts

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