The code bellow let you create a zNode under a specific path.
Calling the method "
CuratorFramework::create
" will return the path of the created zNode.
You will get this error if the parent zNode doesn't exist in ZooKeeper:
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /path
You will get this error if the zNode exists in ZooKeeper:
org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for /path
In order for the code bellow to work:
► Make sure to update the "
CONNECT_STRING
" variable with your information.