Mattias Petter Johansson mpj
Snurra Broker is a message bus with a stream interface. Below is an example on how to interact with it. Snurra plays very nicely with libraries like highland.js (http://highlandjs.org/), but Snurra Broker does not depend on it - snurra creates plain vanilla node streams, and will work with any stream library.
_ = require 'highland' Broker = require 'snurra-broker' broker = new Broker() # Calling the broker with a string (a channel name), creates a
Snurra - the streaming message bus.
Let's walk through the basic syntax of Snurra.
var _ = require('highland'); var snurra = require('snurra'); var bus = snurra();
1. Inspection and Simulation
The primary ambition of Snurra is to make it easier to see what is happening inside your program, mock external dependencies and to verify behavior.
2. Usability over correctness
Snurra tries looks upon the API consumer like a user, rather than a developer that can be expected to fiddle around with unclear interfaces and vague documentation.
3. No magic and no veils
Snurra tries to expose vanilla node streams as cleanly as possible and not abstract them away from the user, so that the user can take advantage of node stream documentation and stream manipulation libraries like highland.js. It is willing to sacrifice being terse or hand-holding in order to be understandable and re-usable.