vlingo / xoom-common

The VLINGO XOOM platform SDK common tools shared across various projects.
Other
16 stars 10 forks source link

Support for composition of Completes #14

Open jkonecki opened 5 years ago

jkonecki commented 5 years ago

I would like to suggest a new feature of Complete composition.

I would like to create a new single Complete from a collection of Completes. This will support a fan-out design pattern, where the client may message multiple actors and need to await all the calls to finish (equivalent of Task.WhenAll). Another potential scenario to support is the equivalent of Task.WhenAny - the new Complete will trigger when the first of the source completes triggers.

The suggested interface (I don't know Java so please forgive any syntax errors):

static <T[]> Completes<T> whenAll(final Completes<T>[]) 
static <T> Completes<T> whenAny(final Completes<T>[]) 

It may be useful to have support for composing Completes of different generic types - the scenario here would involve querying multiple actors for different type of information and than aggregating results.