2 Replies Latest reply on Jul 2, 2004 1:19 AM by victor.sauermann

    TreeCacheListener in JBoss 3.2.x and for client apps

    victor.sauermann

      Hello there!

      I'm using TreeCache in a Clustered JBoss environment. I created a startup MBean, which loads several data entries to the TreeCache. All well so far.
      But now: There is a possiblity to "Listen" for changes via TreeCacheListener.
      For this I created a simple Singleton based class file but this instance is only locally available.
      Now what kind of Java class do I have to use in a cluster. I've tried another MBean but this one never told me of changes...

      Further more: I've read that it is possible to connect a client application (which doesen't run in the same context like the JBoss server cluster) to the TreeCache. How will this feature be performed?

        • 1. Re: TreeCacheListener in JBoss 3.2.x and for client apps

          Hi,

          To listen for cache event, you just need a pojo class to implement TreeCacheListener. You will also need to add the listener to the cache of course. You can do it in your start MBean and that should be it.

          You can try another MBean, but just keep in mind the life cycle of the MBeans, i.e., registration of listener before the data is inserted, etc.

          As for the last point, can you elaborate further your use case? TreeCache is a MBean service inside JBoss AS. So anything you can do with a MBean, you can use it on TreeCache.

          -Ben

          • 2. Re: TreeCacheListener in JBoss 3.2.x and for client apps
            victor.sauermann

            Thanks
            Did I understand you right? Even in a cluster environment it is sufficient to place a POJO class with no Bean characterristic. I thought the Listener should be cluster enabled (like stateless beans with clustered=yes tag in the descriptor file...)

            And for the client:
            We need a very fast communication through our whole three tier application.
            The client app will demand a status of a hardware device and makes a rmi request to a MBean. This MBean checks the status of the chosen field device. Afterwards the MBean, which holds an instance of the field device, puts the new status into the tree cache. Then the TreeCacheListener will get this information and (by now) sends a message driven bean to a message queue, where the client app will receive the wished information.

            This "transaction" should be performed in about 150ms. Therefor I thought about enabling TreeCacheListening on the client app itself. This will spare some code, or not?
            And this is the question: Is this possible?

            Thanks a lot...