MCPcopy Index your code
hub / github.com/ajlopez/SimpleBus

github.com/ajlopez/SimpleBus @0.0.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.0.4 ↗ · + Follow
11 symbols 16 edges 6 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SimpleBus

Simple Service Bus implementation, for Node.js.

Installation

Via npm on Node:

npm install simplebus

Usage

Reference in your program:

var simplebus = require('simplebus');

Create a local message bus:

var bus = simplebus.createBus();

Create a local message bus with a fixed size message queue (recommended):

var bus = simplebus.createBus(1000);

Send a message to local bus:

bus.post("foo");
bus.post({ operation: 'sale', price: 100, quantity: 10 });

Subscribe to a message

// to all message
bus.subscribe(null, function (msg) { ... });
// to messages with property operation === 'sale'
bus.subscribe({ operation: 'sale' }, function(msg) { ... });
// to messages that satisfy a predicate
bus.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.git
cd SimpleBus
npm install
npm 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

Contribution

Feel free to file issues and submit pull requests � contributions are welcome.

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.

(Thanks to JSON5 by aseemk. This file is based on that project README.md).

Core symbols most depended-on inside this repo

getRandom
called by 3
samples/Market/operator.js
postOperation
called by 1
samples/Market/operator.js
createOperation
called by 1
samples/Market/operator.js
makeObjectPredicate
called by 1
lib/simplebus.js
registerClient
called by 1
lib/simplebus.js
Bus
called by 0
lib/simplebus.js
RemoteServer
called by 0
lib/simplebus.js
Server
called by 0
lib/simplebus.js

Shape

Function 11

Languages

TypeScript100%

Modules by API surface

lib/simplebus.js8 symbols
samples/Market/operator.js3 symbols

For agents

$ claude mcp add SimpleBus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact