vlingo / xoom-common

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

Support Completes<T> and CompletableFuture<T> In One Pipeline #15

Open VaughnVernon opened 5 years ago

VaughnVernon commented 5 years ago

When starting out with either Completes<T> or CompletableFuture<T> and then transitioning to the other in the same pipeline, you can't get back to Completes<T> from CompletableFuture<T> because CompletableFuture<T> only returns CompletableFuture<T> instances.

This is a problem where with vlingo-http, for example, a RequestHandler must return a Completes<T> rather than CompletableFuture<T>.

The solution is for Completes<T> to support both Completes<T> and CompletableFuture<T> as parameters to the various forms of andThen() and andThenTo().

In time we may also choose to support CompletableFuture<T> for vlingo-http Request/Response.

P.S. We can't expect CompletableFuture<T> to support Completes<T> ever, so it's on us to support CompletableFuture<T>.