Is JBossCache appropriate for this problem ?
monocongo Mar 1, 2005 5:43 PMI want to have an object in which I store user activity information, and I want this object to be replicated across all nodes of a cluster. When one node of the cluster fails I don't want to lose the data being stored in this object. Essentially it will act as a central and unique (global) repository for my application's user activity information. No matter which node's Servlets service the user's requests the user activity information record (containing login time, last error, etc., updated at each request) should be stored in the same object, which should survive a crash of one or more nodes of the cluster. In this way I will be able to see all user information from the same UserActivityManager object (I plan to view this data using MBean methods).
I already have such a class coded and working as an HASingleton MBean, but it is a bit clunky and does not support failover whenever the master node of the cluster goes down. From what I've been able to find out it appears that I will never be able to get true failover capabilities using this Singleton-based approach, and need to come up with a better solution. I am hoping that JBossCache will be able to do the trick.
I have created an MBean class, UserActivityManager, which stores the user activity records in a TreeCacheAop member object. This MBean is deployed in its own SAR file in the deploy directory. In this SAR I have the UserActivityManager MBean class and interface, as well as two deployment descriptors: jboss-service.xml, which describes the MBean itself (with just a code and name), and replSync-service.xml, which I use to configure the TreeCacheAop object (this is the replSync-service.xml from the example, unaltered).
So far I have not been able to get the MBean to either replicate or failover as I'd like, and before I spend too much more time with it I wanted to ask here to make sure that I will be able to make this work as I want. If not then hopefully someone can suggest a better idea.
If this is the right approach then how should I go about configuring the MBean and/or TreeCacheAop to get the behavior I'm looking for ? How do I make it so that only one of these MBeans is used by all nodes of a cluster ? If this is not the right way to go about this then what is a better option ? I have considered/suggested using Hibernate objects for this instead, but my manager is against the idea of using a database for this sort of temporary persistence. (It seems like a logical solution to me, but I'm somewhat of a rookie and hence have little decision making clout.)
If anyone can comment on the above I will certainly appreciate the feedback. I am by no means an expert on this sort of thing and will gladly consider any reasonable advice. Also I can post my MBean code and deployment descriptors if this will help.
Thanks in advance.
--James