Documentation
¶
Index ¶
- Constants
- func Connect(ctx context.Context, cfg Config) (*nats.Conn, jetstream.JetStream, error)
- func EnsurePCGroup(ctx context.Context, js jetstream.JetStream, cfg Config) error
- func EnsureStream(ctx context.Context, js jetstream.JetStream, cfg Config) error
- func GetMemberIDs() string
- func SafeToken(s string) string
- type Config
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 EnsurePCGroup ¶
func EnsureStream ¶
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
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 ¶
Click to show internal directories.
Click to hide internal directories.