yfinkelstein / node-zookeeper

node.js client for Apache Zookeeper
MIT License
479 stars 111 forks source link

examples: update connect and disconnect scenario by using a timer #328

Closed DavidVujic closed 1 year ago

DavidVujic commented 1 year ago

Description

Updated the examples section, on how to handle connection issues with a ZooKeeper server.

Motivation and Context

Originates from #327

How Has This Been Tested?

  1. running a ZooKeeper server in podman/docker
  2. Starting the client, making sure it is connected
  3. disable the podman/docker network
  4. verify that the client has lost connection.
  5. reconnect the network.

The steps above have been made within the timeout period, to confirm the client is reconnecting, and longer than the timeout to confirm the client is exiting.

Also, starting up a client with an already disabled network, making sure it connects when the network is up and running again.

Example:

docker run --rm -p 2181:2181 zookeeper
node examples/index.js
docker network disconnect <network id/name> <container id>

docker network connect <network id/name> <container id>

Types of changes

Checklist: