Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-delayed-queue

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-delayed-queue

A priority job queue backed by redis, built for eggjs.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

egg-delayed-queue

NPM version build status Test coverage David deps Known Vulnerabilities npm download

A priority queue queue backed by redis, built for eggjs.

Install

$ yarn add egg-delayed-queue

Usage

// {app_root}/config/plugin.js
exports.queue = {
  enable: true,
  package: 'egg-delayed-queue',
};

Configuration

// {app_root}/config/config.default.js
'use strict';
exports.queue = {
  client: {
    queuePrefix: 'q',
    redis: {
      port: 6379,
      host: '127.0.0.1',
      auth: '',
      db: 3,
      // see https://github.com/mranney/node_redis#rediscreateclient
      options: {
      },
    },
  },
  // clients: {}
};

see config/config.default.js for more detail.

Example

// 在 app.js 里面调用 如果需要用到ctx 可以 const ctx = app.createAnonymousContext();
app.queue.process('orderNo', (job, done) => {
  // 这里可以调用service里面的方法来消费这些信息
  const ctx = app.createAnonymousContext();
    ctx.service.home.dealOrder(job.data, done); // dealOrder是自定义的方法
});

// 在需要的地方订阅一个消息
app.queue.create('orderNo', {
    orderNo: '1111111',
    create_time: Date.now()
}).delay(milliseconds) // 延时多少毫秒
  .save();

form more config please see here

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Package last updated on 02 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc