middleware

package
v0.0.0-...-d2be49e Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDecoratorsToHandler

ApplyDecoratorsToHandler applies all the decorators in inverse order so that d1, d2, d3 results in d3(d2(d1(fn))).

Types

type Logger

type Logger interface {
	Printf(format string, a ...interface{})
}

type MessageHandlerDecorator

type MessageHandlerDecorator func(sqsconsumer.MessageHandlerFunc) sqsconsumer.MessageHandlerFunc

MessageHandlerDecorator is a decorator that can be applied to a handler.

func TrackConsumptionRate

func TrackConsumptionRate(log Logger, period time.Duration, format string) MessageHandlerDecorator

TrackConsumptionRate invokes the logger once per specified period with the format and the int64 number of requests consumed during the period

func TrackMessageAge

func TrackMessageAge(period time.Duration, f func(age float64)) MessageHandlerDecorator

TrackMessageAge is middleware that tracks the exponential moving average of message age, calling a callback function with the current average periodically

func TrackMetrics

func TrackMetrics(successes, failures *expvar.Int, timing *expvar.Float) MessageHandlerDecorator

TrackMetrics decorates a MessageHandler to collect metrics about successes, failures and runtime reports in ms*10.

func UnwrapSNSMessage

func UnwrapSNSMessage() MessageHandlerDecorator

UnwrapSNSMessage decorates a MessageHandler to unwrap messages sent via SNS

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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