node-modules/zookeeper-cluster-client

Name: zookeeper-cluster-client

Owner: node_modules

Description: Sharing one zookeeper connection among Multi-Process on Node.js

Created: 2017-07-25 04:09:20.0

Updated: 2018-05-20 02:02:42.0

Pushed: 2018-04-12 08:12:50.0

Homepage: null

Size: 36

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

zookeeper-cluster-client

NPM version build status Test coverage David deps Known Vulnerabilities NPM download

Support cluster-client process model on node-zookeeper-client.

Install
i zookeeper-cluster-client --save
Usage

1. Create a node using given path:

t zookeeper = require('zookeeper-cluster-client');
t client = zookeeper.createClient('localhost:2181');
t path = process.argv[2];

nt.once('connected', async function() {
ait client.create(path);
nsole.log('Node: %s is successfully created.', path);
ait client.close();


nt.connect();

2. List and watch the children of given node:

t zookeeper = require('zookeeper-cluster-client');
t client = zookeeper.createClient('localhost:2181');
t path = process.argv[2];

c function listChildren(client, path) {
nst children = await client.getChildren(
path,
event => {
  console.log('Got watcher event: %s', event);
  listChildren(client, path);
});
nsole.log('Children of %s are: %j.', path, children);


nt.once('connected', () => {
nsole.log('Connected to ZooKeeper.');
stChildren(client, path);


nt.connect();
Support APIs
Extends APIs

Provides some useful APIs beyond node-zookeeper-client.

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.