Name: ali-ons
Owner: ali-sdk
Description: Aliyun Open Notification Service Client
Created: 2015-11-12 05:17:02.0
Updated: 2018-01-15 10:09:35.0
Pushed: 2018-01-10 12:38:52.0
Homepage: null
Size: 83
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Aliyun Open Notification Service Client (base on opensource project RocketMQ)
Sub module of ali-sdk.
install ali-ons --save
consumer
strict';
t httpclient = require('urllib');
t Consumer = require('ali-ons').Consumer;
t consumer = new Consumer({
tpclient,
cessKey: 'your-accesskey',
cretKey: 'your-secretkey',
nsumerGroup: 'your-consumer-group',
isBroadcast: true,
umer.subscribe(config.topic, '*', function*(msg) {
nsole.log(`receive message, msgId: ${msg.msgId}, body: ${msg.body.toString()}`)
umer.on('error', err => console.log(err));
producer
strict';
t httpclient = require('urllib');
t Producer = require('ali-ons').Producer;
t Message = require('ali-ons').Message;
t producer = new Producer({
tpclient,
cessKey: 'your-accesskey',
cretKey: 'your-secretkey',
oducerGroup: 'your-producer-group',
ucer.ready(() => {
nsole.log('producer ready');
nst msg = new Message('your-topic', // topic
'TagA', // tag
'Hello ONS !!! ' // body
oducer.send(msg, (err, sendResult) => console.log(err, sendResult));