ali-ons
Aliyun Open Notification Service Client
Last updated 4 months ago by denghongcai .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ali-ons 
SYNC missed versions from official npm registry.

ali-ons

NPM version build status David deps

Aliyun Open Notification Service Client (base on opensource project RocketMQ)

Sub module of ali-sdk.

Install

npm install ali-ons --save

Usage

consumer

'use strict';

const httpclient = require('urllib');
const Consumer = require('ali-ons').Consumer;
const consumer = new Consumer({
  httpclient,
  accessKeyId: 'your-accessKeyId',
  accessKeySecret: 'your-AccessKeySecret',
  consumerGroup: 'your-consumer-group',
  // namespace: '', // aliyun namespace support
  // isBroadcast: true,
});

consumer.subscribe(config.topic, '*', async msg => {
  console.log(`receive message, msgId: ${msg.msgId}, body: ${msg.body.toString()}`)
  // return Consumer.ACTION_RETRY; // you can return ACTION_RETRY, then this message will be directly retried
});

consumer.on('error', err => console.log(err));

producer

'use strict';
const httpclient = require('urllib');
const Producer = require('ali-ons').Producer;
const Message = require('ali-ons').Message;

const producer = new Producer({
  httpclient,
  accessKeyId: 'your-accessKeyId',
  accessKeySecret: 'your-AccessKeySecret',
  producerGroup: 'your-producer-group',
  // namespace: '', // aliyun namespace support
});

(async () => {
  const msg = new Message('your-topic', // topic
    'TagA', // tag
    'Hello ONS !!! ' // body
  );

  // set Message#keys
  msg.keys = ['key1'];

  // delay consume
  // msg.setStartDeliverTime(Date.now() + 5000);

  const sendResult = await producer.send(msg);
  console.log(sendResult);
})().catch(err => console.error(err))

Secure Keys

Please contact to @gxcsoccer to give you accessKey

License

MIT

Current Tags

  • 3.3.0-beta.8                                ...           beta (2 years ago)
  • 3.8.1                                ...           latest (4 months ago)

35 Versions

  • 3.8.1                                ...           4 months ago
  • 3.8.0                                ...           4 months ago
  • 3.7.2                                ...           5 months ago
  • 3.7.1                                ...           5 months ago
  • 3.7.0                                ...           10 months ago
  • 3.6.5                                ...           a year ago
  • 3.6.4                                ...           a year ago
  • 3.6.3                                ...           a year ago
  • 3.6.2                                ...           a year ago
  • 3.6.1                                ...           a year ago
  • 3.6.0                                ...           a year ago
  • 3.5.1                                ...           a year ago
  • 3.5.0                                ...           a year ago
  • 3.4.0                                ...           a year ago
  • 3.3.0                                ...           2 years ago
  • 3.3.0-beta.8                                ...           2 years ago
  • 3.3.0-beta.7                                ...           2 years ago
  • 3.3.0-beta.6                                ...           2 years ago
  • 3.3.0-beta.5                                ...           2 years ago
  • 3.3.0-beta.4                                ...           2 years ago
  • 3.3.0-beta.2                                ...           2 years ago
  • 3.3.0-beta.1                                ...           2 years ago
  • 3.3.0-beta.0                                ...           2 years ago
  • 3.2.2                                ...           2 years ago
  • 3.2.1                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.0.4                                ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 73
Last Day 2
Last Week 68
Last Month 287
Dependencies (15)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |