EJB design: Client callback from EJB
How to do a callback from an EJB to an applet. Whenever I get some events to the Bean, I have to notify the applet about the event.Can you give me pointers as to where I can find some examples or any other site where I can get information regarding this.
- Posted by: Sobhanadri Vezzu
- Posted on: April 18 2001 07:43 EDT
THEORETICALLY you can pass a remote interface to the bean, which it uses to make the call back. I can't remember if that's outlawed in the spec but I don't remember seeing it.
IN PRACTICE, you're in trouble unless this is a pure intranet situation?
If it's internet, you will have a problem. Your firewall probably won't let the outgoing RMI packets out and it's a very safe bet the client firewall won't let them in (Since they originate from you, the ACK bit will NOT be set in the original packet that requests a connection, the client firewall will kick it out, the connection will never form.) You can't HTTP tunnel the connections since callbacks aren't allowed using HTTP tunnelling.
However, you shouldn't really expect a bean to take a callback hook and then go do some work asynchronously, that's not really what they are supposed to be used for. It could pop the remote interface on a JMS queue for something else to take off and use, but even then the above firewall problems will plague you in the internet world.
Most of the time I've seen people try this, they end up with a client thread doing an HTTP poll to a servlet periodically to see if the "answer" to the original question is available yet.
What is it you are trying to do exactly?
Thanks for your reply.
We are developing a n/w management system where whenever device sends traps we add a record into the database and also intimate it to the operator who will be watching it on a browser on a remote machine.
I agree with Tony. Polling over HTTP is the most common solution that works.
You may want to use SOAP for this purpose...
Check out foll. for details ..
SOAP should allow ur application to pull the server side data using HTTP.
Have you considerd using JMS?