randombits-org / gwt-dispatch

Implements a reusable 'command pattern' API for GWT.
10 stars 1 forks source link

Support aggregating actions initiated close together to reduce network traffic #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch file depends on the patch submitted as part of issue 23.

Using the filter implementation included as part of issue 23, this patch 
adds an aggregating action filter to the dispatch service. 
    This filter queues up actions before sending to the server so
    that actions dispatched close together go as one http request
    rather than several.

Actions are collected into an AggregatedActions object before being sent to 
the server. On the server side the handler needs to be registered. For 
example, using a guice module:
  bindHandler(AggregatedActions.class, AggregatingActionHandler.class);

and the filter needs to be setup on the client side. For example, using a 
gin module:

@Override
    protected void configure() {
       bind(ExceptionHandler.class).to(DefaultExceptionHandler.class);
    }

    @Provides
    @Singleton
    protected DispatchAsync provideDispatchAsync(
            ExceptionHandler exceptionHandler, 
AggregatingDispatchAsync filter) {
        ArrayList<DispatchAsyncFilter> filters = new 
ArrayList<DispatchAsyncFilter>();
        filters.add(filter);
        return new StandardDispatchAsync(exceptionHandler, 
filters);
    }

Original issue reported on code.google.com by ben.binf...@gmail.com on 25 Jan 2010 at 11:13

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Bitmei...@gmail.com on 25 Apr 2010 at 2:07

GoogleCodeExporter commented 9 years ago

Original comment by Bitmei...@gmail.com on 28 Apr 2010 at 2:55

GoogleCodeExporter commented 9 years ago

Original comment by Bitmei...@gmail.com on 18 Aug 2010 at 7:04

GoogleCodeExporter commented 9 years ago
I know this is _very_ late , but I've take a look at this issue and at issue 
#23 . They both seem interesting, but I don't yet see the use case. I believe 
that the act of sending multiple actions together is covered by the batch 
action handler. 

This implementation also covers actions which are not intentionally combined, 
but I am not sure whether the extra complexity is worth it.

Original comment by robert.munteanu on 21 Apr 2011 at 7:31