This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes notifying clients Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "notifying clients" Watch "notifying clients" New topic
Author

notifying clients

Matt Furness
Greenhorn

Joined: Apr 14, 2003
Posts: 2
Hi,
I'm writing a j2ee application with thick clients, using ejbs on the server. What I need to happen is that when certain information on the server is updated the server notifies all the clients about the change. What is the best way of doing this (if it is even possible).
Any help would be greatly appreciated
-Matt.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I would use the JMS API. In this case, it would be a Message Driven Bean (MDB). Your application will "fire" an event (notifyClients) and it will continue processing other stuff... it's some sort of asynchronous communication. you send your "notification" to a MDB and the Bean will deal with notifying your customers.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Originally posted by Andres Gonzalez:
I would use the JMS API. In this case, it would be a Message Driven Bean (MDB). Your application will "fire" an event (notifyClients) and it will continue processing other stuff... it's some sort of asynchronous communication. you send your "notification" to a MDB and the Bean will deal with notifying your customers.


Unfortunately it's his CLIENT that needs to be notified, not the server -- MDB's are EJB's so they only run on the server. The only way for him to accomplish this is to have each client set up a MessageListener (using setMessageListener on the JMS Session) and then have all of the message listeners listen on a common Topic.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Matt Furness
Greenhorn

Joined: Apr 14, 2003
Posts: 2
Hi,
Thanks for your replies.
The advice you gave, Kyle, works, thanks!!
Just as a follow up, is using jms the best way of doing this, or is there a better approach.
Thanks in advance.
-Matt.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: notifying clients
 
Similar Threads
How to run multiple Threads in Eclipse?
Blank JOptionPane RMI
why this exception?
Count of the clients accessing the server
how to know client ip