stream

package
v2.29.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 14 Imported by: 2 modules, 16 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

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