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.
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...