Asynchronous messages from web tier


Web tier: servlets, JSP, Web frameworks: Asynchronous messages from web tier

  1. Asynchronous messages from web tier (8 messages)

    The application we´re building will contain transactions initiated from the web tier (i.e when the user clicks a button in the GUI) and these transactions will take several seconds for the legacy systems to process. During this time the user either will have to wait (looking at the upper right corner of the browser window...), or, preferrably, I would like to allow him/her to continue using the GUI and somehow receive a signal or message when the transaction is done.

    Has anyone experience in asynchronous communication from the wevb tier like this?

    Threaded Messages (8)

  2. Well, I'd try to avoid it if you can, but if it's really essential to the GUI I know two common options. One is to set up some applet in the background which either polls or receives async notification of updates and updates the browser appriopriately. The other option, which I usually prefer, is to have some piece of Java Script run un the background and poll some servlet for update notifications. When it receives one, it reloads the appropriate page.

  3. The best way would be to call an MDB from a servlet. When the processing is done, have the MDB send an email to the user...
  4. Asynchronous messages from web tier[ Go to top ]

    We have done this in a data-entry and correction project where we had to duplicate the behaviour of the legacy system.

    Put in its simplest form: the page uses three frames. The top frame has the image of the form. The middle frame has the form initialized with the OCR output. The bottom frame has the transaction list. The user compares what's in the image with the output of the OCR, makes corrections if necessary and saves the data.

    The transaction list is updated using "push" technology (multipart, new part replaces old). The servlet end of the transaction list waits on a session attribute (a syncronized List of transaction info objects).

    Each request's parameters and the reference to the List object is copied into a Command object and passed on to a new thread and the servlet returns immediately. When the thread finishes, it notifies the thread waiting on the session attribute, which, in this case, is the transaction list servlet, which re-reads the list, writes the new part and flushes, thus updating the transaction list.

    Hope this helps.
  5. Asynchronous messages from web tier[ Go to top ]

    AFAIK the MIME type "multipart/x-mixed-replace" is not supported by Internet Explorer (any version). How do you get around this?

  6. Asynchronous messages from web tier[ Go to top ]

    Another bit of information to remember for the next project, thanks Gal ;-)...

    Anyway, the user desktops were SuSE Linux boxes (the previous program was a customized X application) and ours ran in Netscape Communicator (4.3?).
  7. Asynchronous messages from web tier[ Go to top ]

    Ahh, the luxury of using browsers that actually support internet standards... a rare commodity nowadays :)

  8. Asynchronous messages from web tier[ Go to top ]

    I think the x- in "multipart/x-mixed-replace" actually stands for "experimental", though this has not stopped Microsoft from implementing a feature before. It must be something else...

    Anyway, with IE you could still do it with client pull (auto-refresh) configured for a short refresh cycle (10s?), but, it will not be the same thing. The user will have to wait for the next cycle or refresh the list manually to see the outcome.
  9. See Pushlets