• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

communication between EJB and client

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 25608
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic