ax-rocketmq
Fork Aliyun Open Notification Service Client
Last updated a year ago by anxing131 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ax-rocketmq 
SYNC missed versions from official npm registry.

RocketMQ-Nodejs-client

NPM version build status David deps node version

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

Sub module of ali-sdk.

Install

npm install ax-rocketmq --save

Usage

consumer

'use strict';

const httpclient = require('urllib');
const Consumer = require('ax-rocketmq').Consumer;
const consumer = new Consumer({
  httpclient,
  consumerGroup: 'your-consumer-group',
  namesrvAddr: 'your-namesrv-address'
  // isBroadcast: true,
});

consumer.subscribe(config.topic, '*', async msg => {
  console.log(`receive message, msgId: ${msg.msgId}, body: ${msg.body.toString()}`)
});

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

producer

'use strict';

const httpclient = require('urllib');
const Producer = require('ax-rocketmq').Producer;
const Message = require('ax-rocketmq').Message;

const producer = new Producer({
  httpclient,
  producerGroup: 'your-producer-group',
  namesrvAddr: 'your-namesrv-address'
});

producer.ready(() => {
  console.log('producer ready');
  const msg = new Message('your-topic', // topic
    'TagA', // tag
    'Hello ONS !!! ' // body
  );

  producer.send(msg, (err, sendResult) => console.log(err, sendResult));
});

License

MIT

Current Tags

  • 3.0.2                                ...           latest (a year ago)

3 Versions

  • 3.0.2                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 3
Dependencies (17)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |