topic-stream

0.2.1 • Public • Published

topic-stream Build Status

The topic-stream is a writable stream which translates objects written to into JSON messages which it sends over an AMQP topic.

NPM NPM

Example

This is a simple example using event-stream to pipeline data entered via stdin, split it into lines and send it via topic stream to /events/input over AMQP.

"use strict";
 
var es = require('event-stream');
var amqplib = require('amqplib');
var topicStream = require('../index.js');
var log = require('debug')('read-stdin-topic-stream');
 
// exit once we have processed the data that was piped in.
process.stdin.on('close', process.exit);
 
log('Connection', 'open');
 
var open = amqplib.connect();
 
topicStream(open, {exchangeName: 'events/syslog'}, function (err, ts) {
  log('topicStream', 'open');
  es.pipeline(process.stdin, es.split(), ts);
});

Anything sent to stdin on the process will be split into lines and packaged into AMQP messages.

TODO

  • Add the option to just pass an AMQP URL.

License

Copyright (c) 2013 Mark Wolfe Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i topic-stream

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • wolfeidau