nats

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NatsRealtimeBus

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

NatsRealtimeBus is a NATS-backed fan-out bus with optional JetStream durability.

func GetNatsRealtimeBus

func GetNatsRealtimeBus(cfg *models.Config) (*NatsRealtimeBus, error)

GetNatsRealtimeBus builds a NATS realtime bus, embedding a server when needed.

func (*NatsRealtimeBus) Close

func (b *NatsRealtimeBus) Close() error

Close drains the connection and shuts down the embedded server if present.

func (*NatsRealtimeBus) Publish

func (b *NatsRealtimeBus) Publish(_ context.Context, topic string, payload []byte) error

Publish sends payload on the NATS subject (JetStream when enabled).

func (*NatsRealtimeBus) Subscribe

func (b *NatsRealtimeBus) Subscribe(ctx context.Context, topic string) (<-chan []byte, error)

Subscribe creates a live-tail subscription (DeliverNew when JetStream is on).

func (*NatsRealtimeBus) SubscribeReplay

func (b *NatsRealtimeBus) SubscribeReplay(ctx context.Context, topic string, policy interfaces.ReplayPolicy) (<-chan []byte, error)

SubscribeReplay delivers historical messages per policy then continues live.

Jump to

Keyboard shortcuts

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