4

I have a project that have clients(swing) and will have an EJB application running on server.

My question is about communication. I want to use MDB's (message driven beans) when client send message to server. But i've stucked on the issue that app server sends message (or any data) to notify client.

For example, client1 has a form (a textbox and a button) and client2 has a list (lists data that client1 sends to server). When client1 sends the data (message etc) to server, do some job on it than send(notify) the data to client2.

How can i do this? Any help would be appreciated. Thanks.

  • What latency is acceptable? Some approaches are examined [here](http://stackoverflow.com/q/13810374/230513). – trashgod Mar 13 '14 at 12:06

1 Answers1

1

There are may ways to achieve what you are asking.

What I personally prefer is:

client1 has a SB(Session Bean) running that connects to a JMS Queue (The JMS Queue is setup on the server) we will call it inQueue for now.

once the form data is in the inQueue you will need an MDB (message driven bean running on the server which will pick up the data from the inQueue we will call it MDBInQueue.

The server within the MDBInQueue processes the data received in the form and generates the appropriate output format for client two.

Now again within MDBInQueue it sends the response on another queue again residing in the server. we will call this outQueue.

the client2 has an MDB running which we will call it MDBOutQueue. This will pick up the messages generated from the server which are ready to be viewed by the client2.

Let me know if you need any additional details

otc
  • 694
  • 1
  • 9
  • 40
  • how is the connection URL in `jndi.properties` in the client loaded? Assuming that the Swing client is using JMS to send messages to the server. – Thufir Mar 09 '15 at 04:33