[infinispan-issues] [JBoss JIRA] (ISPN-9811) Implement single response publisher methods
William Burns (Jira)
issues at jboss.org
Mon Dec 10 09:41:00 EST 2018
William Burns created ISPN-9811:
-----------------------------------
Summary: 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
Fix For: 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