Created
March 31, 2016 17:15
-
-
Save thefourtheye/faf3c1de1f13b1c023e99d45f34aa2d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am using Apache Curator Recipes v2.10.0, with Scala 2.11.8. I want to be notified whenever there is a change (addition, deletion, and updation) in the Node I am watching. Following is the code I have, | |
curatorClient = CuratorFrameworkFactory.newClient("proper Connection String"), | |
new ExponentialBackoffRetry(1000, 3)) | |
curatorClient.start() | |
treeCache = new TreeCache(curatorClient, "/a") | |
treeCache.start() | |
treeCache.getListenable.addListener(new TreeCacheListener { | |
override def childEvent(client: CuratorFramework, event: TreeCacheEvent): Unit = { | |
event.getType match { | |
case TreeCacheEvent.Type.NODE_ADDED => ERROR("TreeNode added: " | |
+ ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: " | |
+ new String(event.getData.getData)) | |
case TreeCacheEvent.Type.NODE_UPDATED => ERROR("TreeNode Updated: " | |
+ ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: " | |
+ new String(event.getData.getData)) | |
case TreeCacheEvent.Type.NODE_REMOVED => ERROR("TreeNode Removed: " | |
+ ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: " | |
+ new String(event.getData.getData)); | |
case ex: TreeCacheEvent.Type => ERROR(s"Received Event [$ex]") | |
} | |
} | |
}) | |
Now, the only message I get from this is | |
Received Event [INITIALIZED] | |
Nothing else. I tried adding nodes to /a through zkCli and also through the program (I use util-zk library for inserting). What am I missing? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment