This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB Messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Messages" Watch "EJB Messages" New topic

EJB Messages

Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
Hi everyone,

I'm a bit new to EJB, so forgive me if this question is too simple - I just can't seem to figure it out. I have some stateful beans running on a server and when the bean runs, it should have the ability to send out a message indicating its progress to whatever client is currently using the bean. When this was a non-distrbuted application, I could simply register the client with the "server" as a listener and then the server would iterate over its listeners and send out status messages.

This is a problem for a couple of reasons now:
1. The server throws a NoClassLoaderFoundException because when it tries to resolve the type of the listener, it fails (maybe putting the appropriate client interfaces in the JBoss client directory would solve this, but that leads to #2...).
2. I obviously don't want to be sending a GUI back and forth (since that is the registered listener to be displaying the status of the bean).

So, long question short, is there a way to send a message to the client using the bean at the time? I've looked into message-driven beans and JMS but it seemed like messages there went to a Queue, in which case I would need a different queue for each client, which ties the client/server together a little tighter than I care to do.

Thanks in advance.
Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
I'd like to clarify my thoughts just a little bit here because I know my first message was quite long.

Simply put, is there a way for a bean to send a message to the client that is currently using it (i.e. a status message to update a progress bar on the client GUI)?

I agree. Here's the link:
subject: EJB Messages
It's not a secret anymore!