Cluster EventBus
Simple library for communicating different processes.
I developed the library for communicating different cluster processes. It also connects different machines in the same local network to share clusters and distribute the work.
$ npm install cluster-eventbus --save
Sample working on a Node cluster:
const numCPUs = length;const cluster = ;const EventBus = ; let eventBus = core: `MacBook Pro (914)` debug: true; if clusterisMaster for let i = 1; i < numCPUs + 1; i++ cluster; else eventBus;
Ask
Ask something to a worker:
let response = await eventBusevent`MacBook Pro (914)``worker_1` "message": `hello worker 1` "id": `test_worker`
Response model:
Ask To All
Ask the same to all workers:
let response = await eventBus
Response model:
Close Process
Close everything by calling:
await
Machine Name
EventBusMACHINE_NAME
Response:
MacBook Pro (914)