pubsubmiddleware

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MessageIDKey ctxKeyMessageID = 0

MessageIDKey is the key that holds the unique request ID in a request context.

Variables

This section is empty.

Functions

func Acker

func Acker(h xpubsub.Handler) xpubsub.Handler

Acker is a middleware that checks if the subsequent handlers returns an error and on success ackes them. In case of failure it Nacks the message if it is possible.

func ContextMetadata

func ContextMetadata(next xpubsub.Handler) xpubsub.Handler

ContextMetadata sets up the metadata from the message in the context.

func CtxSubject

func CtxSubject(ctx context.Context) string

CtxSubject gets the subscription subject from the given context.

func CtxSubscriptionID

func CtxSubscriptionID(ctx context.Context) string

CtxSubscriptionID gets the subscription id from the given context.

func GetMessageID

func GetMessageID(ctx context.Context) string

GetMessageID returns a message ID from the given context if one is present. Returns the empty string if a message ID cannot be found.

func Logger

func Logger(next xpubsub.Handler) xpubsub.Handler

Logger is a middleware function that is used for trace logging incoming message on subscriptions.

func MessageID

func MessageID(next xpubsub.Handler) xpubsub.Handler

MessageID is a middleware function that generates new request id and puts it into message context, A message ID is a string of the form "host.example.com/random-0001", where "random" is a base62 random string that uniquely identifies this go process, and where the last number is an atomically incremented request counter. The concept and implementation of this request id is based on the brilliant golang library: github.com/go-chi/chi.

func Recoverer

func Recoverer(h xpubsub.Handler) xpubsub.Handler

Recoverer recovers from any panic in the handler and appends RecoveredPanicError with the stacktrace to any error returned from the handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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