I would like to develop a way of monitoring business-level events in real time for my application (SEAM 2, AS 6, Richfaces 3.3.3), eg. ...Joe Bloggs has registered a new account etc.
Originally I was going to create a new logging appender (I am using log4j) and just tail the log file through a terminal window, but then I thought there is probably a much better way to do this with less overhead. The events dont need to be persisted so I guess I could create a transient entity that can be outputted to a webpage using normal JSF/Richfaces methods, then update the log every minute via AJAX
The bit I am not quite sure about is how to make this log entity's context application-wide, and how to avoid memory issues, presumably I could just use a List or Map to store a String for each entry and ensure the size of the list doesnt exceed a max amount?
Has anyone done something similar to this? And if so could they share any thoughts on the best way to go about it
Thanks in advance
Well I implemented the above by creating a component and using the Application scope and @startup to store all new events, they are stored within an arraylist that is constrained to 50 entries. Seems to work quite well
Im still interested to know if this is the best method as I noticed in Dan Allen's SEAM in Action it warns against using the Application scope to store business objects as they are expensive to synchronise. But as the data I am storing is just a String and a Date I assume this would not apply
|Retrieving data ...|