@pager/minion-joi
v1.1.0
Published
Joi validation for pager/minion workers
Downloads
200
Maintainers
Readme
Minion-joi — Joi validation for pager/minion workers
Usage Example
const validation = require('minion-joi')
const validator = validation(Joi.object({
foo: Joi.string().required()
}))
const handler = (message) => {
return `Hello ${message.foo}`
}
module.exports = validator(handler)
By default minion will nack and not requeue messages on failure, if you want the message to be requeued after failing validation you can do it like this:
const validation = require('minion-joi')
const validator = validation(Joi.object({
foo: Joi.string().required()
}), { requeue: false })
const handler = (message) => {
return `Hello ${message.foo}`
}
module.exports = validator(handler)