Errai: The browser as a platform

Wednesday, March 5, 2014

Have you taken Errai Data Sync for a spin yet?

Last June we released the first version of the Errai Data Sync module. It complements Errai JPA and provides functionality to automatically keep your local entities (persisted in local storage) in sync with the server. See the original blog post for details.

We have just added a new declarative, annotation-driven API that will make using Errai Data Sync even easier. Here's a short example:


When a user navigates to this page, either by browsing to #GroceryListView;activeUserId=1 or by transitioning from another page, a data sync worker will start to periodically synchronize the entities that match the query specified in the parameter to @Sync. This query parameter refers to a named query defined on an entity type: in this case GroceryList. The @SyncParams refer to fields of the enclosing managed bean to use them as query parameter values. In the example above we make use of the activeUserId field to only synchronize the grocery list of the currently active user.

The onDataSyncComplete method is invoked every time a synchronization cycle completes. It can be used to update the UI with the new data or to resolve conflicts. By default, conflicts are resolved in a favour of the server but you can change this behaviour (see the documentation for details).

We encourage you to try out Errai DataSync and are eager to get your feedback! What additional functionality would you like to see? Do you like the API or have changes to propose?

Please join us on Freenode #errai, the errai-dev mailing list, or on our community forums.

No comments:

Post a Comment