ali-sdk/ali-ons

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ali-ons

NPM version build status David deps node version

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

Sub module of ali-sdk.

Install
install ali-ons --save
Usage

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

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.