@apio/gravity-worker
v1.1.0
Published
Package to help handle Apio Gravity jobs.
Downloads
168
Keywords
Readme
Apio Gravity Worker Helper
Helps you implement gravity job workers:
const {Worker} = require('/path/to/apio-gravity-worker/index.js')
const w = new Worker({
topic: 'project.resource.action',
scheduling: '* * * * *',
gravityUrl: config.gravityBaseUrl
})
// React to a job
w.on('job', async job => {
console.log("New job received",job)
})
// Starts the cron
w.start()
// Not waiting for the first cron tick running it right away
w.dequeue()