// to all messagebus.subscribe(null, function (msg) { ... });// to messages with property operation === 'sale'bus.subscribe({ operation: 'sale' }, function(msg) { ... });// to messages that satisfy a predicatebus.subscribe(function (msg) { return msg.price < 100; }, function(msg) { ... });
Expose a bus as a server:
var server = simplebus.createServer(bus, port, [host]);server.start();///server.stop();
Consume as a client:
var client = simplebus.createClient(port, [host]);client.start(function () { // callback when connection is OK client.post("foo"); client.subscribe(function (msg) { return msg.price > 100 }, function (msg) { .... });});///client.stop();
Development
git clone git://github.com/ajlopez/SimpleBus.gitcd SimpleBusnpm installnpm test
Samples
Market A distributed sample. Operator
send buy or sale messages, subscriber listen to selected messages.
Versions
0.0.1: Published
0.0.2: Published, bus with maximum message queue size
0.0.3: Published, using SimpleRemote 0.0.5, updated engine range
0.0.4: Published, with improved error handling, via remster and sidrees