如何在React堆通量排序之前获得订单

yi0zb3m4  于 2021-09-13  发布在  Java
关注(0)|答案(1)|浏览(290)

我有一张这样的清单 List<Mono<Integer>> numberMonos = new LinkedList(); 我使用这段代码将list转换为mono,但由于并发性的原因,顺序发生了变化。 Flux.fromIterable(contentPlatformDetailDTOMonos).flatMap(x -> x).collectList(); 在React堆通量排序之前,当我使用此代码来转换它时,我如何获得订单。

wmvff8tz

wmvff8tz1#

concatMap() 接线员:https://projectreactor.io/docs/core/release/api/reactor/core/publisher/flux.html#concatmap-java.util.function.function-。
对于整个画面,我在这里重复javadoc:

/**
 * Transform the elements emitted by this {@link Flux} asynchronously into Publishers,
 * then flatten these inner publishers into a single {@link Flux}, sequentially and
 * preserving order using concatenation.
 * <p>
 * There are three dimensions to this operator that can be compared with
 * {@link #flatMap(Function) flatMap} and {@link #flatMapSequential(Function) flatMapSequential}:
 * <ul>
 *     <li><b>Generation of inners and subscription</b>: this operator waits for one
 *     inner to complete before generating the next one and subscribing to it.</li>
 *     <li><b>Ordering of the flattened values</b>: this operator naturally preserves
 *     the same order as the source elements, concatenating the inners from each source
 *     element sequentially.</li>
 *     <li><b>Interleaving</b>: this operator does not let values from different inners
 *     interleave (concatenation).</li>
 * </ul>
 *
 * <p>
 * Errors will immediately short circuit current concat backlog.
 *
 * <p>
 * <img class="marble" src="doc-files/marbles/concatMap.svg" alt="">
 *
 * <p><strong>Discard Support:</strong> This operator discards elements it internally queued for backpressure upon cancellation.
 *
 * @param mapper the function to transform this sequence of T into concatenated sequences of V
 * @param <V> the produced concatenated type
 *
 * @return a concatenated {@link Flux}
 */
public final <V> Flux<V> concatMap(Function<? super T, ? extends Publisher<? extends V>>
        mapper) {

相关问题