forever-task

0.1.2 • Public • Published

Forever Task

  • Forever task is a task which only stops when receiving stop signal. While running, it emits some data.
  • Forever tasks include crawling, micro service, etc
  • Allow distributed workers

Installation

$ npm install forever-task

Usage

1. Worker

const { Forever } = require('forever-task')
const forever = new Forever()
forever.process({
  MyId: {
    resolver(_, { send }) {
      send({ ping: true })
    }
  }
})

2. start/stop Worker

const jobId = forever.start('MyId')
// stop
forever.stop(jobId)

3. ubscribe/unsubscribe to data

const subId = forever.subscribe('MyId')
// unsubscribe
forever.unsubscribe(subId)

Readme

Keywords

none

Package Sidebar

Install

npm i forever-task

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

79.7 kB

Total Files

22

Last publish

Collaborators

  • tndgroup