nats

package
v1.7.1 Latest Latest
Warning

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

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

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