[infinispan-issues] [JBoss JIRA] (ISPN-9811) Implement single response publisher methods
William Burns (Jira)
issues at jboss.org
Thu Jan 17 14:51:01 EST 2019
[ https://issues.jboss.org/browse/ISPN-9811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
William Burns updated ISPN-9811:
--------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
> Implement single response publisher methods
> -------------------------------------------
>
> Key: ISPN-9811
> URL: https://issues.jboss.org/browse/ISPN-9811
> Project: Infinispan
> Issue Type: Sub-task
> Components: Publisher
> Reporter: William Burns
> Assignee: William Burns
> Priority: Major
> Fix For: 10.0.0.Beta1, 10.0.0.Final
>
>
> We need to implement the backend for a method like
> {code}
> <R> CompletionStage<R> compose(Function<? super Publisher<T>, ? extends CompletionStage<R>> transformer,
> Function<? super Publisher<R>, ? extends CompletionStage<R>> finalizer);
> {code}
> This would allow for all methods that don't require streaming results to be done very easily.
> For example a count method can then just be implemented by doing:
> {code}
> java.util.function.Function<Publisher<?>, CompletionStage<Long>> transformer = cp ->
> Flowable.fromPublisher(cp)
> .count()
> .to(RxJavaInterop.singleToCompletionStage());
> java.util.function.Function<Publisher<Long>, CompletionStage<Long>> finalizer = results ->
> Flowable.fromPublisher(results)
> .reduce((long) 0, Long::sum)
> .to(RxJavaInterop.singleToCompletionStage());
> return infinispanPublisher.compose(transformer, finalizer);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the infinispan-issues
mailing list