New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@tuia/egg-rocketmq

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuia/egg-rocketmq

egg rocketmq plugin

latest
npmnpm
Version
1.0.0
Version published
Maintainers
8
Created
Source

egg-rocketmq

Install

$ npm i egg-rocketmq --save

Configuration

// {app_root}/config/plugin.js
exports.rocketmq = {
  enable: true,
  package: 'egg-rocketmq'
};
// {app_root}/config/config.default.js
exports.rocketmq = {
  producer: {
    options: {
      nameServer: 'your rocketmq server',
      compressLevel: 5,
      sendMessageTimeout: 3000,
      maxMessageSize: 1024 * 128
    },
    topicsList: [{
      groupId: 'test-1',
      instanceName: '', // optional
      groupName: 'test-1',
      topic: 'test-1'
    }, {
      groupId: 'test-2',
      instanceName: '', // optional
      groupName: 'test-2',
      topic: 'test-2'
    }],
  },
  consumer: {
    options: {
      nameServer: 'your rocketmq server',
    },
    topicsList: [{
      topic: 'test-1',
      groupId: 'test-1',
      groupName: 'test-1',
      instanceName: '', // optional
      serviceFloderName: 'consumer', // service floder name
      fileNameWithMethod: 'receive.testMsg1' // service filename and method name
    }, {
      topic: 'test-2',
      groupId: 'test-2',
      groupName: 'test-2',
      instanceName: '', // optional
      serviceFloderName: 'consumer',
      fileNameWithMethod: 'receive.testMsg2'
    }]
  }
};

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

Usage

// producer
await this.ctx.service.producer.index('test-1', {
  body: 'I am your dad-1'
});

// consumer
const Service = require('egg').Service;
module.exports = class Receive extends Service {
  async testMsg1(topic, payload) {
    this.ctx.logger.info(topic, payload);
  }
};

see example/app/service/producer.js and example/app/service/consumer/receive.js for more detail.

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

egg

FAQs

Package last updated on 13 Aug 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