Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5706219FD9 for ; Thu, 31 Mar 2016 20:57:24 +0000 (UTC) Received: (qmail 97970 invoked by uid 500); 31 Mar 2016 20:57:24 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 97924 invoked by uid 500); 31 Mar 2016 20:57:24 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 97909 invoked by uid 99); 31 Mar 2016 20:57:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2016 20:57:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B9697C0222 for ; Thu, 31 Mar 2016 20:57:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id K-siykAkiESY for ; Thu, 31 Mar 2016 20:57:21 +0000 (UTC) Received: from mail-vk0-f41.google.com (mail-vk0-f41.google.com [209.85.213.41]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id F1B7F5F1D5 for ; Thu, 31 Mar 2016 20:57:20 +0000 (UTC) Received: by mail-vk0-f41.google.com with SMTP id k1so119076958vkb.0 for ; Thu, 31 Mar 2016 13:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=WgX9+CwrQN2UP/n8iRW2xoruW52y8nA0p3S5B1ioibc=; b=nh45RvQYlooBVKLtHT5cRz72Q+VrGD2eQ85sZhxt2BP6aNrGNdYQoIix/Qw5G2OpoW FmiYGHBw7uGOYdDnTThOq0qBNuE/IxOrdtFy3uvkSfGKWZXHl5lo+7IFHUrxsQyK1WLY hTu1SKqh5ChpnSbpJuK1FIIPLW0Q8I9ifNF92GZPM+m0ZsWqlZAMBQGnVAqQw9oupOY+ N+Is4YneJPj/mjkcQjmg8Lw4L2O7ihS8jdyAK7kuB+o8jelOMF+rsqCFVukdFuFrAJmr REG1HcmYFsQDw9oqIqfCIIEjYIRODBzJcohMGRRMQOwK6TgD3iXAh1cEYVKsRfFoSyGe w3iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=WgX9+CwrQN2UP/n8iRW2xoruW52y8nA0p3S5B1ioibc=; b=VJl39+dXyLi+iGtxAK5+TjuFnniEhZ8Yzwrw0wkanDt7i/4Kp+SO6ua8rPBRy90KfP TInzimOZrEAZZqeMNM0+GMQmOXPDyo+qcLn5ichfaoj7qtugxjuaIvQmMMmfI07M//cx TmKa7e7v+9f05M6/sTfqRb2k44ZmKyhT81hMY288AMPMthiocSILObgRzwFg2emjR7Kx g5w2E4wBSQl9L0QAcm2U7xDOxT0xnxtbxs0mF2Iw1rPj6DRiKNFbPQCKowLUaRXpon/v 6IjqJx/DZkXJWqy2tplltsGPSU5fePQxl6A4/P5+4aUl2Vz4oQruemi1kLGhWOBieHpc 0IgA== X-Gm-Message-State: AD7BkJLiiJZfRs+m1IsNOcWyTOn3MeBQ+GznpmO0wRmDaigYwk9QaWpGoxxt7UJe+2hFw753U32Zcu0tajjHzQ== MIME-Version: 1.0 X-Received: by 10.159.33.208 with SMTP id 74mr712936uac.114.1459457839885; Thu, 31 Mar 2016 13:57:19 -0700 (PDT) Received: by 10.176.69.227 with HTTP; Thu, 31 Mar 2016 13:57:19 -0700 (PDT) In-Reply-To: References: Date: Thu, 31 Mar 2016 16:57:19 -0400 Message-ID: Subject: Re: TreeCache not working From: Scott Blum To: Jordan Zimmerman Cc: user@curator.apache.org Content-Type: multipart/alternative; boundary=001a113564581c74df052f5e8202 --001a113564581c74df052f5e8202 Content-Type: text/plain; charset=UTF-8 I might suggest, as a debugging step, you setup a loop with a sleep and periodically poll the TreeCache for it's state and log the results. That might help you narrow down whether TreeCache has any data at all vs. a user-level event propagation. On Thu, Mar 31, 2016 at 4:56 PM, Scott Blum wrote: > I took a cursory look but I've never used Scala. Nothing seems obviously > wrong, so I'm not sure what to say? I'm pretty sure TreeCache generally > works as intended. > > On Thu, Mar 31, 2016 at 4:06 PM, Jordan Zimmerman < > jordan@jordanzimmerman.com> wrote: > >> Scott, please have a look. >> >> On Mar 31, 2016, at 12:29 PM, Sakthipriyan Vairamani < >> sakthiprofessional@gmail.com> wrote: >> >> 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? >> >> >> > --001a113564581c74df052f5e8202 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I might suggest, as a debugging step, you setup a loop wit= h a sleep and periodically poll the TreeCache for it's state and log th= e results.=C2=A0 That might help you narrow down whether TreeCache has any = data at all vs. a user-level event propagation.

On Thu, Mar 31, 2016 at 4:56 PM, Scott = Blum <dragonsinth@gmail.com> wrote:
I took a cursory look but I've never us= ed Scala.=C2=A0 Nothing seems obviously wrong, so I'm not sure what to = say?=C2=A0 I'm pretty sure TreeCache generally works as intended.
=

On Thu, Mar 31, 2016 at 4:06 PM, Jordan Zimmerman <jordan@jordanzimmerman.com> wrote:
Scott, please hav= e a look.

On Mar 31,= 2016, at 12:29 PM, Sakthipriyan Vairamani <sakthiprofessional@gmail.com> = wrote:

I am using Apache Curator Recipes v2.10.0, w=
ith Scala 2.11.8. I want to be notified whenever there is a change (additio=
n, deletion, and updation) in the Node I am watching. Following is the code=
 I have,

    curatorClient =3D CuratorFrameworkFactory.newClient("proper Connec=
tion String"),
      new ExponentialBackoffRetry(1000, 3))
    curatorClient.start()

    treeCache =3D new TreeCache(curatorClient, "/a")
    treeCache.start()

    treeCache.getListenable.addListener(new TreeCacheListener {
      override def childEvent(client: CuratorFramework, event: TreeCacheEve=
nt): Unit =3D {

        event.getType match {
          case TreeCacheEvent.Type.NODE_ADDED =3D> ERROR("TreeNode =
added: "
            + ZKPaths.getNodeFromPath(event.getData.getPath) + ", valu=
e: "
            + new String(event.getData.getData))
          case TreeCacheEvent.Type.NODE_UPDATED =3D> ERROR("TreeNod=
e Updated: "
            + ZKPaths.getNodeFromPath(event.getData.getPath) + ", valu=
e: "
            + new String(event.getData.getData))
          case TreeCacheEvent.Type.NODE_REMOVED =3D> ERROR("TreeNod=
e Removed: "
            + ZKPaths.getNodeFromPath(event.getData.getPath) + ", valu=
e: "
            + new String(event.getData.getData));
          case ex: TreeCacheEvent.Type =3D> 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?



--001a113564581c74df052f5e8202--