broker

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client owns a NATS connection and its JetStream context.

func New

func New(settings *brokerTypes.Settings, options ...ClientOption) (*Client, error)

New creates and initializes a NATS client. Options apply sequential after types.Settings and can override them

func (*Client) Close

func (client *Client) Close()

Close closes the underlying NATS connection.

func (*Client) Conn

func (client *Client) Conn() *nats.Conn

Conn returns the underlying NATS connection.

func (*Client) GetJetStreamReplicas

func (client *Client) GetJetStreamReplicas() int

GetJetStreamReplicas returns the configured replica count.

func (*Client) NewConsumerGroup

func (client *Client) NewConsumerGroup(configList ...consumer.Config) brokerInterfaces.ConsumerGroup

NewConsumerGroup creates a configured group of consumers.

func (*Client) NewConsumerManager

func (client *Client) NewConsumerManager() brokerInterfaces.ConsumerManager

NewConsumerManager creates a consumer management client.

func (*Client) NewKVManager

func (client *Client) NewKVManager() brokerInterfaces.KVManager

NewKVManager creates a KeyValue manager.

func (*Client) NewPublisher

func (client *Client) NewPublisher() brokerInterfaces.Publisher

NewPublisher creates a JetStream publisher.

func (*Client) NewStreamManager

func (client *Client) NewStreamManager() brokerInterfaces.StreamManager

NewStreamManager creates a stream manager.

type ClientOption

type ClientOption func(*clientOptions)

ClientOption configures optional client behavior.

func WithJetStreamOptions

func WithJetStreamOptions(options ...jetstream.JetStreamOpt) ClientOption

WithJetStreamOptions adds JetStream client options

func WithNATSOptions

func WithNATSOptions(options ...nats.Option) ClientOption

WithNATSOptions adds connection options applied after Settings options

type ClientProvider

type ClientProvider interface {
	NewKVManager() brokerInterfaces.KVManager
	NewStreamManager() brokerInterfaces.StreamManager
	NewPublisher() brokerInterfaces.Publisher
	NewConsumerGroup(configList ...consumer.Config) brokerInterfaces.ConsumerGroup
	NewConsumerManager() brokerInterfaces.ConsumerManager
	GetJetStreamReplicas() int
	Close()
}

ClientProvider creates broker layers from one NATS connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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