by ali-sdk

ali-sdk / ali-ons

Aliyun Open Notification Service Client

132 Stars 39 Forks Last release: Not found MIT License 84 Commits 26 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


NPM version build status David deps

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

Sub module of ali-sdk.


npm install ali-ons --save



'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));


'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( + 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



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.