package mq import ( "context" "errors" "sync/atomic" ) var consumerSequence atomic.Uint64 type MessageHandler func(context.Context, string, []byte) error type permanentError struct{ err error } func (e permanentError) Error() string { return e.err.Error() } func (e permanentError) Unwrap() error { return e.err } // Permanent marks an inbound handler failure that must not be requeued. func Permanent(err error) error { if err == nil { return nil } return permanentError{err: err} } func IsPermanent(err error) bool { var target permanentError return errors.As(err, &target) }