Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@pager/minion-joi

1.1.0 • Public • Published

Minion-joiJoi 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)

Install

npm i @pager/minion-joi

DownloadsWeekly Downloads

26

Version

1.1.0

License

MIT

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar