Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

notifying clients

 
Matt Furness
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Matt Furness
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic