4 Replies Latest reply on May 29, 2008 8:37 AM by Dor B.D

    Catching Nodes Events

    Dor B.D Newbie

      I know there is a TreeCacheListener. I implemented it and created my own listener.

      Now, Is it possible to send an event when a value is been added to a specific node? How can i catch such an event?

      I need it as an event, is it possible to catch such ? How ? Can you give me an example?


      Thanks in advance to you all,

      Dor

        • 1. Re: Catching Nodes Events
          Manik Surtani Master

          Implement TreeCacheListener.nodeModified().

          It will be called whenever nodes are modified. You can then inspect the Fqn passed in to test whether this is the node you are interested in.

          Otherwise, if you use JBoss Cache 2.X, the listeners are much more powerful with an event-based callback mechanism. Please see the JBoss Cache 2.X user guide for details.

          • 2. Re: Catching Nodes Events
            Dor B.D Newbie

            First of all thanks for you quick answer, still read this -->

            I will clarify my question, due to the fact that i am using the nodeModified.

            I need to know, by event if it's possible, what exactly object have you insert inside or into that node that has been modified.

            For example:
            Root
            |
            MyContainer (Node)
            |
            TempObject(key), 2(value)

            Now, after the insertion of tempobject i will have an event of MyContainer node that has been modified. But, I want to know what was the value that was insert to this node. In this case, TempObject as a key and 2 as it's value.
            Is that possible ?

            Thanks in advance,

            Dor

            • 3. Re: Catching Nodes Events
              Manik Surtani Master

              Possible in 2.X. :-) In 1.X you would have to call a get() in your nodeModified() impl, which is inefficient.

              • 4. Re: Catching Nodes Events
                Dor B.D Newbie

                That's probably the problem, because i am now using 1.4.1 sp9 version and not the new stable version.

                Thanks, I will check this out.

                Thanks again.

                Dor