Documentation ¶
Index ¶
- func ApplyDecoratorsToHandler(fn sqsconsumer.MessageHandlerFunc, ds ...MessageHandlerDecorator) sqsconsumer.MessageHandlerFunc
- type Logger
- type MessageHandlerDecorator
- func TrackConsumptionRate(log Logger, period time.Duration, format string) MessageHandlerDecorator
- func TrackMessageAge(period time.Duration, f func(age float64)) MessageHandlerDecorator
- func TrackMetrics(successes, failures *expvar.Int, timing *expvar.Float) MessageHandlerDecorator
- func UnwrapSNSMessage() MessageHandlerDecorator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDecoratorsToHandler ¶
func ApplyDecoratorsToHandler(fn sqsconsumer.MessageHandlerFunc, ds ...MessageHandlerDecorator) sqsconsumer.MessageHandlerFunc
ApplyDecoratorsToHandler applies all the decorators in inverse order so that d1, d2, d3 results in d3(d2(d1(fn))).
Types ¶
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