I am still working on this to make it failsafe, but I basically create a Map with the username as key and the Listener as the Value. When you register the Listener you place it in the Map using the current User. I use an observer to listen for user specific messages and after storing it, it triggers the listener. The messages can also be send from time-consuming asynchronous tasks, because I just send an event with the message. I use the growl component (primefaces) to visuzalize the messages.
I am still working on this because the proces is completely asynchronous, so I had to limit the miber of messages and - more important - you must remove the listener from the Map when the user logs out. This is simple when he does that correctly, but more laborous when he just clicks the close icon (depends on the session time out)
I you want I can share some tested code , but it needs some additional work.
Sorry to thread jack.
I have read your other threads where you present this type of solution to deal with JMS messages. If the code has changed from your previous posting I would appreciate if you can share it.
I was curious if this solution allows clustering of Jboss? I recall it was using an application scoped bean, when I looked for reasons why application scope bean cannot be clustered I never found a reason.
I am not at work at the moment, so I can't send you the code until tomorrow. I've tried different solutions to get async produced messages to the user. When used in combination with JMS, I think it can even be used in a clustered environment. The MDB can use Seam components and especially the Events component can come to the rescue here. When the MB receives a mesage it just re-sends it through the Seam event. Whatever application-scoped bean can pick the message up.
Additionally I use JMS with an additional username parameter, which can be used for filtering on a Topic.
As mentioned already in other threads, Seam really misses POJO-JMS integration and especially on the reception part! There are different requests for such functionality (Nikolay posted on and I had another), but they are still not picked up and - dus to the Seam 3 pressure - I doubt if such functionality will be avilable on tyhe short term for Seam 2.
P.S. maybe you should start another thread, because we are miss-using Aman's thread here.
Thanks guys. I do already have achieved a asynchronous tasks solution, where on the server side, the asynchronous tasks on completion send a jms message and the listener eventually pushes a rich modal component. This is the part of our notification system.
This solution could be tricky for most of seam users at least for me.
So I thought why not enhance the existing seam update, delete, save notification messages to run asynchronously. This is what I am looking for and should be an easy solution to implement. I am still researching on this.