events

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRestartRetries         = 5
	InitialRestartBackoffTime = 150 * time.Millisecond
)
View Source
const DefaultDefaultAsyncPubAckInflight = 256

Default `defaultAsyncPubAckInflight` is `4000` (`nats.go`)

View Source
const DescriptionPrefix = "FiveNet: "

Variables

View Source
var Module = fx.Module("events",
	fx.Provide(
		New,
	),
	fx.Decorate(wrapLogger),
)

Functions

func GetJetstreamMsgContext added in v0.8.21

func GetJetstreamMsgContext(msg jetstream.Msg) (spanContext trace.SpanContext, err error)

func GetNatsMsgContext added in v0.8.21

func GetNatsMsgContext(msg *nats.Msg) (spanContext trace.SpanContext, err error)

Types

type ConsumeErrRestartFn added in v0.8.21

type ConsumeErrRestartFn func(ctx context.Context, c context.Context) error

type JSWrapper added in v0.8.21

type JSWrapper struct {
	jetstream.JetStream
	// contains filtered or unexported fields
}

Ensures certain NATS config options are applied

func NewJSWrapper added in v0.8.21

func NewJSWrapper(js jetstream.JetStream, cfg config.NATS, shutdowner fx.Shutdowner) *JSWrapper

func (*JSWrapper) ConsumeErrHandler added in v0.8.21

func (j *JSWrapper) ConsumeErrHandler(logger *zap.Logger) jetstream.PullConsumeOpt

func (*JSWrapper) ConsumeErrHandlerWithRestart added in v0.8.21

func (j *JSWrapper) ConsumeErrHandlerWithRestart(c context.Context, logger *zap.Logger, restartFn ConsumeErrRestartFn) jetstream.PullConsumeOpt

func (*JSWrapper) CreateOrUpdateKeyValue added in v0.8.21

func (j *JSWrapper) CreateOrUpdateKeyValue(ctx context.Context, cfg jetstream.KeyValueConfig) (jetstream.KeyValue, error)

func (*JSWrapper) CreateOrUpdateStream added in v0.8.21

func (j *JSWrapper) CreateOrUpdateStream(ctx context.Context, cfg jetstream.StreamConfig) (jetstream.Stream, error)

func (*JSWrapper) Publish added in v0.8.21

func (j *JSWrapper) Publish(ctx context.Context, subject string, payload []byte, opts ...jetstream.PublishOpt) (*jetstream.PubAck, error)

func (*JSWrapper) PublishAsync added in v0.8.21

func (j *JSWrapper) PublishAsync(ctx context.Context, subject string, payload []byte, opts ...jetstream.PublishOpt) (jetstream.PubAckFuture, error)

func (*JSWrapper) PublishMsg added in v0.8.21

func (j *JSWrapper) PublishMsg(ctx context.Context, msg *nats.Msg, opts ...jetstream.PublishOpt) (*jetstream.PubAck, error)

func (*JSWrapper) PublishMsgAsync added in v0.8.21

func (j *JSWrapper) PublishMsgAsync(ctx context.Context, msg *nats.Msg, opts ...jetstream.PublishOpt) (jetstream.PubAckFuture, error)

type Params added in v0.8.0

type Params struct {
	fx.In

	LC         fx.Lifecycle
	Shutdowner fx.Shutdowner

	Logger *zap.Logger
	Config *config.Config
}

type Result added in v0.8.13

type Result struct {
	fx.Out

	JS *JSWrapper
}

func New added in v0.8.0

func New(p Params) (res Result, err error)

type Subject added in v0.8.0

type Subject string

type Topic added in v0.8.0

type Topic string

type Type added in v0.8.0

type Type string

Jump to

Keyboard shortcuts

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