XMLWordPrintable

Details

    Description

      We need to implement the backend for a method like

         <R> CompletionStage<R> compose(Function<? super Publisher<T>, ? extends CompletionStage<R>> transformer,
               Function<? super Publisher<R>, ? extends CompletionStage<R>> finalizer);
      

      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:

            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);
      

      Attachments

        Activity

          People

            wburns@redhat.com Will Burns
            wburns@redhat.com Will Burns
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: