Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AckDelivery ¶
func AckDelivery(onErrFn OnErrFunc) amqprpc.ServerMiddlewareFunc
AckDelivery is a middleware that will acknowledge the delivery after the handler has been executed. If the Ack fails the error and the `amqp.Delivery` will be passed to the `OnErrFunc`.
func PanicRecovery ¶
func PanicRecovery(onRecovery func(interface{}, context.Context, *amqprpc.ResponseWriter, amqp.Delivery)) amqprpc.ServerMiddlewareFunc
PanicRecovery is a middleware that will recover any panics caused by a handler down the middleware chain. If a panic happens the onRecovery func will be called with the return value from recover().
func PanicRecoveryLogging ¶
func PanicRecoveryLogging(logFunc amqprpc.LogFunc) amqprpc.ServerMiddlewareFunc
PanicRecoveryLogging is a middleware that will recover any panics caused by a handler down the middleware chain. If a panic happens the value will be logged to the provided logFunc.
Types ¶
type OnErrFunc ¶
OnErrFunc is the function that will be called when the middleware get an error from `Ack`. The error and the delivery will be passed.
func OnAckErrorLog ¶
OnAckErrorLog is a built-in function that will log the error if any is returned from `Ack`.
middleware := AckDelivery(OnAckErrorLog(log.Printf))
func OnAckErrorSendOnChannel ¶
OnAckErrorSendOnChannel will first log the error and correlation ID and then try to send on the passed channel. If no one is consuming on the passed channel the middleware will not block but instead log a message about missing channel consumers.