async http requests to another server

I’m not (yet) a Vaadin user and I’m trying to sort out various system architecture questions before I jump.
Imagine I have a typical vaadin RIA.
At a certain point I need to ask another server for some data.
That server will take a long time to calculate the entire, during which time I want to be able to continue to browse round my data, scroll tables and look at the progress bar.
The server can actually push data back to my app via http in chunks (we’re talking seconds or minutes for whole result set to come back).

Is this a feasible scenario with Vaadin? Is it readily achievable or does it require a lot of work?

In a multi-user environment with different users looking at independent data results, how do I tie my external server’s data into the particular user’s session?


Supplementary question: what if instead of using http I wanted to use Akka to get the data?

All of your code (except for some special cases like custom widgets) are run on the server. This is a traditional Java running environment. What you can do is spawn a separate thread that fetches the data from the other server. By moving it to an other thread, it can work on without blocking the main thread of the Vaadin app, and the app stays responsive. When the data fetching thread has some new data, it can update the compoents to reflect this, like showing a notification to the user.

Because all server roundtrips in Vaadin is always initalized by the client (=browser), this means that the info will get to the browser only when the user clicks on something that causes a server roundtrip, like clicks on any button. The other threads component updates will then piggyback on the button-pressing roundtrip. This is not ideal as usually you want the info to be available to the user the moment that it is available on the server. To fix this is to use one of the many push (or poll) solutions available in Vaadin. There’s a lot of info around about it,
like this sticky thread on the forum
. What it does in simple terms is that it adds opens up a separate roundtrip from the client which the server doesn’t answer to, so it is left hanging. When the server has something to update, it adds it to this hanging roundtrip and answers it, resulting it to instantly get into the browser.

Hope this gave some general picture on how to do it. It shouldn’t be much work and if you have additional, more specific questions, I’ll try to answer those.