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

egg-ons

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-ons - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

4

app.js

@@ -7,5 +7,5 @@ 'use strict';

app.ons = new ONS(app);
app.beforeStart(function* () {
yield app.ons.init();
app.beforeStart(async () => {
await app.ons.init();
});
};
2.0.0 / 2018-07-26
==================
**others**
* [[`3a3b039`](http://github.com/eggjs/egg-ons/commit/3a3b03924d55210be49561fb84cfc0b8f2971ac3)] - refactor: use async await (Yiyu He <<dead_horse@qq.com>>)
1.1.0 / 2018-05-03

@@ -3,0 +9,0 @@ ==================

@@ -24,3 +24,3 @@ 'use strict';

* init() {
async init() {
const { app } = this;

@@ -35,7 +35,7 @@ const { sub, pub } = this.config;

for (const options of sub) {
yield this.createConsumer(options, app.ONSSubscribers);
await this.createConsumer(options, app.ONSSubscribers);
}
for (const options of pub) {
yield this.createProducer(options);
await this.createProducer(options);
}

@@ -49,3 +49,3 @@ }

* createConsumer(options, Subscribers) {
async createConsumer(options, Subscribers) {
const { app, consumerMap, logger, config } = this;

@@ -61,7 +61,7 @@ const consumer = new Consumer(Object.assign({

yield consumer.ready();
await consumer.ready();
logger.info('[egg-ons] consumer: %s is ready, messageModel: %s', consumer.consumerGroup, consumer.messageModel);
app.beforeClose(function* () {
yield consumer.close();
app.beforeClose(async function() {
await consumer.close();
logger.info('[egg-ons] consumer: %s is closed, messageModel: %s', consumer.consumerGroup, consumer.messageModel);

@@ -78,6 +78,6 @@ });

consumer.subscribe(topic, Subscriber.subExpression || '*', function* (msg) {
consumer.subscribe(topic, Subscriber.subExpression || '*', async function(msg) {
const ctx = app.createAnonymousContext();
const subscriber = new Subscriber(ctx);
yield subscriber.subscribe(msg);
await subscriber.subscribe(msg);
});

@@ -87,3 +87,3 @@ }

* createProducer(options) {
async createProducer(options) {
const { app, producerMap, logger, config, topic2Producer } = this;

@@ -103,7 +103,7 @@ const producer = new Producer(Object.assign({

yield producer.ready();
await producer.ready();
logger.info('[egg-ons] producer: %s is ready', producer.producerGroup);
app.beforeClose(function* () {
yield producer.close();
app.beforeClose(async function() {
await producer.close();
logger.info('[egg-ons] producer: %s is closed', producer.producerGroup);

@@ -113,9 +113,9 @@ });

* send(msg) {
async send(msg) {
assert(msg && msg.topic, '[egg-ons] send(msg) msg.topic is required');
const producer = this.topic2Producer.get(msg.topic);
assert(producer, `[egg-ons] CANNOT find producer for topic=${msg.topic}`);
return yield producer.send(msg);
return await producer.send(msg);
}
};
{
"name": "egg-ons",
"version": "1.1.0",
"version": "2.0.0",
"description": "aliyun ons plugin for egg",

@@ -14,16 +14,16 @@ "eggPlugin": {

"dependencies": {
"ali-ons": "^2.0.2"
"ali-ons": "^3.0.0"
},
"devDependencies": {
"autod": "^2.10.1",
"autod-egg": "^1.0.0",
"egg": "^1.9.0",
"egg-bin": "^4.3.5",
"egg-mock": "^3.13.1",
"eslint": "^4.9.0",
"eslint-config-egg": "^5.1.1",
"autod": "^3.0.1",
"autod-egg": "^1.1.0",
"egg": "^2.9.1",
"egg-bin": "^4.7.1",
"egg-mock": "^3.17.3",
"eslint": "^5.2.0",
"eslint-config-egg": "^7.0.0",
"webstorm-disable-index": "^1.2.0"
},
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},

@@ -30,0 +30,0 @@ "scripts": {

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