Red Hat
Feb 15, 2013
by Christian Sadilek
Today's spotlight is on yet another new feature in Errai 3: RPC batching.

GWT and Errai shine in big web applications that implement complex use cases. These use cases often require multiple interactions with the server. RPC batching allows for batched invocations of remote methods that will be executed using a single server round-trip. This is useful for reducing the number of simultaneous HTTP connections and at the same time allows for reusing and combining fine-grained remote services.

Errai offers a lightweight and boilerplate-free RPC mechanism. All details can be found here. Simply inject a BatchCaller instead of a Caller<T> to make use of batched remote procedure calls. The rest of the API should be familiar if you already use Errai. Here's an example:


Only after sendBatch is called will the remote methods get executed. An additional RemoteCallback can be provided to the sendBatch call which will be invoked when all remote calls have completed in success. Consequently, an additional ErrorCallback can be provided which will get executed for all remote calls that have completed in failure.

The credits for inspiring this feature go to our invaluable community member Josh Blinick. The API might still change as we're looking for feedback! If you have ideas or any feedback, please comment. Here's the link to the JIRA.