npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

egg-ebus

v0.1.4

Published

delay queue and event plugin.

Downloads

2

Readme

egg-ebus

NPM version build status [Test coverage][codecov-url] [![David deps][david-image]][david-url] [Known Vulnerabilities][snyk-url] npm download

Install

$ npm i egg-ebus --save

Usage

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

Configuration

// {app_root}/config/config.default.js
exports.ebus = {
};
例如
exports.ebus = {
    app: true,
    agent: true,
    debug: true,
    concurrency: 2,
    listener: {
      baseDir: 'events',//配置监听事件的目录
      options: {
        attempts: 5,
        backoff: {
          delay: 1000,
          type: 'fixed',
        },
      },
    },
    limiter: {
      max: 10,
      duration: 1000
    },
    redis: {
      host: 'localhost',
      port: 6379,
      password: "",
      db: 0,
    },
    queue: {
      default: 'default_bus', // 默认队列名称
      prefix: 'ebus', // 队列前缀
    },
    queues: {
      worker: {
        concurrency: 2,
      },
    },
  }

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

关于监听文件

在配置监听事件的目录下,创建监听文件,可看考源码的demo/app/events/的orderListener文件

Example

get 获取队列 emit 添加队列
例如 const point = await this.app.ebus.emit("order_action", { ord_no: 123 }, { delay: 1000, removeOnComplete: true, removeOnFail: true });此用例用于发送延时队列

cleanOn (Removes jobs in a specific state, but keeps jobs within a certain grace period) delAll (Completely obliterates a queue and all of its contents.) drain (Removes all jobs that are waiting or delayed, but not active, waiting-children, completed or failed.)

在controller里 使用this.app.ebus.emit(监听的事件,传输数据,可配置delay毫秒数) 可以参考bullmq https://docs.bullmq.io/guide/introduction https://bullmq.io

Questions & Suggestions

Please open an issue here.

License

MIT