examples/basic-worker.js
function basicWorker (job) {
  return Promise.try(() => {
    const tid = getNamespace('ponos').get('tid')
    if (!job.message) {
      throw new WorkerStopError('message is required', { tid: tid })
    }
    console.log(`hello world: ${job.message}. tid: ${tid}`)
  })
}
function basicWorker (job) {
  return Promise.try(() => {
    const tid = getNamespace('ponos').get('tid')
    if (!job.message) {
      throw new WorkerStopError('message is required', { tid: tid })
    }
    console.log(`hello world: ${job.message}. tid: ${tid}`)
  })
}
function basicWorker ( job ) { return Promise . try ( ( ) => { const tid = getNamespace ( 'ponos' ) . get ( 'tid' ) if ( ! job . message ) { throw new WorkerStopError ( 'message is required' , { tid : tid } ) } console . log ( ` ${ job . message } ${ tid } ` ) } ) }
A simple worker that will publish a message to a queue.
@param {object} job Object describing the job.
@param {string} job.queue Queue on which the message will be published.
@returns {promise} Resolved when the message is put on the queue.
A simple worker that will publish a message to a queue .