Methods to Achieve server Callback to client

C

Colin Goudie

Hey,

I'm working on a J2EE app, mainly for learning at the moment. It is a small
Point of Sales type app. I was looking into JMS to see if it could solve
something for me.

The States of the 'tables' in a restaurant are represented by EJB's on the
application server. When they change state (i.e. from empty, to eating,
waiting for main etc..) I'd like to be able to notify the client terminals
so they can colour the tables accordingly etc..

What type of methods are available for this?? Will JMS Help me. It seems to
be used mainly for communication between beans, but I need an EJB to notify
client apps??

Thanks
 
E

Erwin Moller

Colin said:
Hey,

I'm working on a J2EE app, mainly for learning at the moment. It is a
small Point of Sales type app. I was looking into JMS to see if it could
solve something for me.

The States of the 'tables' in a restaurant are represented by EJB's on the
application server. When they change state (i.e. from empty, to eating,
waiting for main etc..) I'd like to be able to notify the client terminals
so they can colour the tables accordingly etc..

What type of methods are available for this?? Will JMS Help me. It seems
to be used mainly for communication between beans, but I need an EJB to
notify client apps??

Thanks

Hi Colin,

I can think of 2 ways to do that:
1) Make your clients listen to a certain port. The server must contact all
the clients if it has an update.
2) Polling: Let your clients poll the server every minute or so.

I think the second will be the easiest to implement.

Tip: Don't send the whole state of every table every time a client polls the
server, but use a timestamp on the server for every client which contains
the last time that client asked the server for the state.
So the server remembers every timestamp for each client.

The server has one timestamp timestamp_LastUpdate or something like that
which contains the moment the last update to the tables was done.
If a client polls for an update, it only sends its own ID, then the server
compares that ID to the timestamp belonging to that ID. If
timestamp_LastUpdate is bigger, the client should do an update.

Hope this helps.
Regards,
Erwin Moller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top