@scalecube/cluster-nodejs
TypeScript icon, indicating that this package has built-in type declarations

0.2.11 • Public • Published

Join the chat at https://gitter.im/scalecube-js/Lobby

This is part of scalecube-js project, see more at https://github.com/scalecube/scalecube-js
Full documentation

Cluster-nodejs

This package provides a default cluster implementation for node-js. it uses SWIM protocol for discovering members in distributed environment.

Basic Usage

import { joinCluster } from '@scalecube/cluster-nodejs';

const clusterOptions = {
  seedAddress,
  address,
  itemsToPublish: [],
};

const cluster = joinCluster(clusterOptions);

// calling `getCurrentMembersData()`, will resolve with the distributed environment's latest state.
cluster.getCurrentMembersData().then(console.log); 

// on subscribe to `listen$()`, we will start getting emits of the distributed environment's latest state.
cluster.listen$().subscribe(console.log); 


// on calling `destroy()`, we will remove our metadata from the distributed environment. 
// also, it stops the cluster from sharing/publishing metadata.
cluster.destroy().then(console.log); 

Readme

Keywords

none

Package Sidebar

Install

npm i @scalecube/cluster-nodejs

Weekly Downloads

125

Version

0.2.11

License

MIT

Unpacked Size

25.3 kB

Total Files

11

Last publish

Collaborators

  • ronen.nachmias
  • idanilt
  • scalecube-ci
  • skolomiiets
  • scalecube-js-user-developer
  • idokatz
  • viktor.pyshnenko