Design to achieve Server callback to client


EJB design: Design to achieve Server callback to client

  1. Design to achieve Server callback to client (2 messages)


    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??

    I have thought about
    1/ Poll Server
    2/ Use sockets. Probably not good with J2EE

  2. Colin,

    JMS is simplest way to perform Callbacks for J2EE apps.

    Your client will need to have a listener in a separate thread to fire off events to your app as JMS messages come in. For your type of app you probably need Publish/Subscribe setup.

    Hope this helps

  3. What mike suggested is the best way to implemnt it.

    You can make a different thread to listen to the output of the server call.

    The conditions that has to be done after the output from the server can be implemented in a different onCallback() method.