Grid live updates


I have a requirement for a “live view” of a grid and data. Meaning everytime a new record is created in the application, and an user has the particular grid on the screen, it needs to automatically and immediately show that new record in the grid. The new records will be created by background processes. So the user should be able to just sit there and watch the grid and new records comning in.

Can anybody suggest the best way to accomplish this?

I don’t really want to do polling, since each user would be polling every second or two, and I feel like that would be a drain.

Would a server push be the best approach? Would I need to create some sort of storage for all the Vaadin UI’s looking at the grid, and then do a push to them when data comes in?

Any advise would be appreciated.


I think server push is what you want. You could use a shared data structure to store the rows and have each UI poll that for new entries, but I wouldn’t. I’d use an event bus (the Guava event bus to be exact, but then I use Guava heavily already). The background process creating the records publishes an event when a new record is available, which is picked up by the subscribing views. You could potentially include the new rows in the event itself so that the views don’t have to go and fetch it from somewhere else, if that makes sense for your application.

Thanks Ian, I do use Guava events already myself. Wouldnt each end user, that is logged into the application, only be subscribed to the event bus for its specific Vaadin UI instance?

My understanding (I haven’t done this yet myself) is that you’d have to use a global static event bus to communicate between UIs.

Here’s an example that does something similar (though not using Guava eventbus), if that’s helpful (note: not my code, credit to the author):

Ok thanks. I will need to figure out how to create a global event bus for this purpose, but it does seems to be the way to go. I also like your idea of including the rows in the fired event…