eggjs/egg-zookeeper

Name: egg-zookeeper

Owner: egg

Description: egg plugin for zookeeper

Created: 2017-02-13 14:33:04.0

Updated: 2018-04-30 04:32:38.0

Pushed: 2018-04-27 04:16:06.0

Homepage: null

Size: 4377

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

egg-zookeeper

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

egg plugin for zookeeper

Install
i egg-zookeeper --save
Usage
  1. Install & enable the plugin in egg
onfig/plugin.js
rts.zookeeper = {
able: true,
ckage: 'egg-zookeeper', 

  1. Create zk client with app.zk.createClient(connectionString) api
t client = app.zk.createClient('localhost:2181');
d client.ready();

t path = '/test-path';

tion listChildren(client, path) {
ient.getChildren(
path,
event => {
  console.log('Got watcher event: %s', event);
  listChildren(client, path);
},
(err, children, stat) => {
  if (err) {
    console.log('Failed to list children of %s due to: %s.', path, err);
    return;
  }
  console.log('Children of %s are: %j.', path, children);
}



reate a new path
nt.create(path, err => {
 (err) {
console.log('Failed to create node: %s due to: %s.', path, err);
else {
console.log('Node: %s is successfully created.', path);


 list and watch the children of given node
stChildren();

APIs

Please refer to zookeeper-cluster-client in detail.

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.