embed

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package embed starts and supervises a single NATS JetStream server in-process. Single-node only per D-55.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node wraps a running NATS server instance.

func StartNode

func StartNode(cfg NodeConfig) (*Node, error)

StartNode starts a single-node embedded NATS JetStream server. Host defaults to "127.0.0.1", ReadyWait defaults to 10s. Port 0 or -1 selects a random available port.

func (*Node) ClientURL

func (n *Node) ClientURL() string

ClientURL returns the NATS client URL for connecting to this server.

func (*Node) Server

func (n *Node) Server() *natsserver.Server

Server returns the underlying NATS server instance.

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown stops the embedded NATS server and waits for it to fully stop.

type NodeConfig

type NodeConfig struct {
	ServerName string
	Host       string
	Port       int
	StoreDir   string
	ReadyWait  time.Duration
}

NodeConfig configures an embedded NATS server. Zero values get sensible defaults via StartNode.

Jump to

Keyboard shortcuts

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