Help us shape the future of Go! Take the 2026 Go Developer Survey

stream

package
v2.52.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 16

Documentation

Overview

Package stream provides streaming clients used by `Consume` and `Publish` methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Nats

func Nats(opts ...natsjs.Option) (events.Stream, error)

nats returns a nats streaming client retries exponentially to connect to a nats server

func NatsFromConfig

func NatsFromConfig(connName string, disableDurability bool, cfg NatsConfig) (events.Stream, error)

NatsFromConfig returns a nats stream from the given config

Types

type Chan

type Chan [2]chan interface{}

Chan is a channel based streaming clients Useful for tests or in memory applications

func (Chan) Consume

func (ch Chan) Consume(_ string, _ ...events.ConsumeOption) (<-chan events.Event, error)

Consume implementation

func (Chan) Publish

func (ch Chan) Publish(_ string, msg interface{}, _ ...events.PublishOption) error

Publish implementation

type NatsConfig

type NatsConfig struct {
	Endpoint             string `mapstructure:"address"`          // Endpoint of the nats server
	Cluster              string `mapstructure:"clusterID"`        // CluserID of the nats cluster
	TLSInsecure          bool   `mapstructure:"tls-insecure"`     // Whether to verify TLS certificates
	TLSRootCACertificate string `mapstructure:"tls-root-ca-cert"` // The root CA certificate used to validate the TLS certificate
	EnableTLS            bool   `mapstructure:"enable-tls"`       // Enable TLS
	AuthUsername         string `mapstructure:"username"`         // Username for authentication
	AuthPassword         string `mapstructure:"password"`         // Password for authentication

}

NatsConfig is the configuration needed for a NATS event stream

Jump to

Keyboard shortcuts

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