config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewSubscriberContextTimeout = 5 * time.Minute

	DefaultAckWait       = 30 * time.Second
	DefaultMaxAckPending = 1 // for strict ordering, only one message will be delivered per consumer

)

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, cfg Config) (*nats.Conn, jetstream.JetStream, error)

func EnsurePCGroup

func EnsurePCGroup(ctx context.Context, js jetstream.JetStream, cfg Config) error

func EnsureStream

func EnsureStream(ctx context.Context, js jetstream.JetStream, cfg Config) error

EnsureStream ensures that the specified stream exists with the given subjects. It will update the stream if necessary only when new subject was added.

func GetMemberIDs

func GetMemberIDs() string

func SafeToken

func SafeToken(s string) string

Types

type Config

type Config struct {
	URL               string        `default:"nats://mdai-hub-nats.mdai.svc.cluster.local:4222" envconfig:"NATS_URL"`
	Subject           string        `default:"eventing"                                         envconfig:"NATS_SUBJECT"`
	StreamName        string        `default:"EVENTS_STREAM"                                    envconfig:"NATS_STREAM_NAME"`
	ClientName        string        `envconfig:"-"`
	InactiveThreshold time.Duration `default:"1m"                                               envconfig:"NATS_INACTIVE_THRESHOLD"`
	NatsPassword      string        `envconfig:"NATS_PASSWORD"`
	Logger            *zap.Logger   `envconfig:"-"`
	// this flag should not be used in prod environment, only for local testing and development
	DevDeleteMembers bool `default:"false"                                            envconfig:"DEV_DELETE_MEMBERS"`
}

func LoadConfig

func LoadConfig() (Config, error)

Jump to

Keyboard shortcuts

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