• Post Reply Bookmark Topic Watch Topic
  • New Topic

communication between EJB and client

 
Ben Zahler
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers!
I've got a problem with my EJBs: how can I make them notify my clients if something's changed? I've tried registring my client as a observer with the bean, but the container wouldn't let me do that (I get a RemoteException), so I tried using Proxies, but when I called getProxy() to obtain the Proxy-Object from the bean I only got a clone which didn't help my cause...
Is there anyone how could helo me?
thanx a lot
Ben
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can't be done. EJB Clients aren't acting as servers, so you can't do calbacks. It's explicitly disallowed by the EJB spec.
Kyle
 
Subhash Nambiar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
WEll let me also know if u find something in this context .As how can i send initimations to client when any change happens in server.
Is it possible or not at all ???
Can singleton approach to ejb will do .But the problem is ,is it possible to apply singleton pattern in case of beans bse beans instance r created by the container and we dont have any control over it.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look folks, you can't do this. Period. End of story. This is forbidden by the EJB spec. You have to use some other mechanism to get callbacks (something like JMS (which would only work if the client can act as a JMS server)) or sockets, or some other approach is the only way of making this work.
Kyle
 
Tim Holloway
Bartender
Posts: 18414
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... Or to put it another way, an EJB is like a package of subroutines like a Windows DLL. It's something that gets CALLED. If you want notifications, code them as server tasks, such as a thread that gets spawned by a servlet, but there's no need get get EJBs involved outside of something that the server task might consult - if then.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just put out a JMS Topic for your clients to listen on? When changes take place, they can be published to the Topic and all of your clients will be promptly notified.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!