you'll get one per session. How about letting each user have a message bean that subscribes to a user list publisher? As each user logs in, send a jms message to the topic which will then be received and added to each user's list. (and same with logoff).
Thanks for your reply,
Even though I have been developing J2EE Entity and Session beans for a while, I am pretty new to Message Driven Beans.
In your example, I don't get to understand where is actually the online user list stored.
As I have understood MDBeans, as you propose it, when a user logs in, he will only receive messages sent by users that log in after him, is that right? This way, a user will have only the list of online users logged after him.
I need to store the user list somewhere... but after reading the tutorial on Message Driven Beans, they seem to be similar to Stateles Session beans: You can have just one or several instances of the bean, depending on the container needs.
Anyway, in my application, only a special user, with admin privileges, is interested in that online user list.
Before changing to J2EE, my application was just a Web application (.war). The online user list was kept as a context attribute. every time a User object was binded to the session, he looked for the context attribute "onlineuserlist", and invoked a online(me) method. The same when this object was unbinded (the user went offline).
I'd like to find a way to migrate this to the container, but I don't find a similar concept in J2EE to "Context attributes" of WEB applications.
Thanks for any help/ideas,