Run reports on application server

I am trying to figure out how to run reports on our application server using the vaadin application. Here is what I want to do, but I am having a little trouble visualizing how to do it.

  1. The user will be prompted for the report parameters and where they want to send the report. One of those destination options is to generate a PDF which will be involved later
  2. Once the job has been submited, I want to free up the client to do other things. The job will be submitted to the application server via web services.
  3. When then job is done, I want to notify the user of that fact, using a toolbar notification. Also if the user wanted to generate a PDF that will need to be downloaded to the client.

I have no problem with the making the calls to the web services, and I know I will need to make use of the server push function. The notification should also be easy. What I am having a problem with is how to handle the PDF in an asynchronize mode. I am doing it currently in a synchonize mode with no problem.

Any suggesion would be appreciated.

Thank you

Hi,

There are practically two ways to do this. Either you post the task to back end that returns you some kind of identifier. Then your UI layer polls when the task is complete and when done somewho notifies the end users that the report is now available. Another option, if your reporting API is synchronous, is to simply spawn another worker thread to do it (instead of doing this in servlets service thread). In this case just be sure that some “treadlocals” and scopes (CDI or Spring) may be undefined. When the result is ready, notify the UI normally, but remember to wrap the update using
UI.access
.

Both mechanisms can use the server push, but also
work just fine using polling
. At UI level you can use ProgressBar to let user know that the long running process is being executed.

cheers,
matti