0.3.1 • Published 6 years ago

egg-task v0.3.1

Weekly downloads
135
License
-
Repository
github
Last release
6 years ago

egg-task

Usage

// [Project]/config/plugin.js
exports.task = {
  enable: true,
  package: 'egg-task',
};

// [Project]/config/config.default.js
config.queue = {
    client: {
      redis: {
        host: 'localhost',
        port: 6379,
        db: 0,
      },
    },
  };

// [Project]/app/task/test.js  // example
'use strict';

const { Task } = require('egg-task');

module.exports = class Test extends Task {

  /**
   * @inheritDoc
   */
  get options() {
    return {
      // bull.js queue.add options
    };
  }

  onCompleted(job, result) { // bull.js queue event
  }

  async process(job) { // bull.js queue.process
      await this.addSubtask('xxx', { number: i }); // subtask
  }
};

// [Project]/app/controller/home.js  // example
this.ctx.task.test.add();
0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago