完成第一个 Mono 后执行 Mono 列表
Executing list of Mono after completing a first Mono
完成 1 个单声道后正在执行单声道列表。
Mono<Project> mono1 = ...;
List<Mono<?>> publishers = new ArrayList<>();
publishers.add(mono2);
publishers.add(mono3);
publishers.add(mono4);
if ( publishers.size() > 0 )
Mono.zip(publishers, res->prj.id);
在这里,我想在完成Mono1后执行Mono的列表。
我可以做链接。但是,与 Mono.zip ... 有什么关系吗?
mono1.then(Mono.zip(publishers, res->prj.id));
查看其 JavaDocs:
/**
* Let this {@link Mono} complete then play another Mono.
* <p>
* In other words ignore element from this {@link Mono} and transform its completion signal into the
* emission and completion signal of a provided {@code Mono<V>}. Error signal is
* replayed in the resulting {@code Mono<V>}.
*
* <p>
* <img class="marble" src="doc-files/marbles/thenWithMonoForMono.svg" alt="">
*
* <p><strong>Discard Support:</strong> This operator discards the element from the source.
*
* @param other a {@link Mono} to emit from after termination
* @param <V> the element type of the supplied Mono
*
* @return a new {@link Mono} that emits from the supplied {@link Mono}
*/
public final <V> Mono<V> then(Mono<V> other) {
完成 1 个单声道后正在执行单声道列表。
Mono<Project> mono1 = ...;
List<Mono<?>> publishers = new ArrayList<>();
publishers.add(mono2);
publishers.add(mono3);
publishers.add(mono4);
if ( publishers.size() > 0 )
Mono.zip(publishers, res->prj.id);
在这里,我想在完成Mono1后执行Mono的列表。
我可以做链接。但是,与 Mono.zip ... 有什么关系吗?
mono1.then(Mono.zip(publishers, res->prj.id));
查看其 JavaDocs:
/**
* Let this {@link Mono} complete then play another Mono.
* <p>
* In other words ignore element from this {@link Mono} and transform its completion signal into the
* emission and completion signal of a provided {@code Mono<V>}. Error signal is
* replayed in the resulting {@code Mono<V>}.
*
* <p>
* <img class="marble" src="doc-files/marbles/thenWithMonoForMono.svg" alt="">
*
* <p><strong>Discard Support:</strong> This operator discards the element from the source.
*
* @param other a {@link Mono} to emit from after termination
* @param <V> the element type of the supplied Mono
*
* @return a new {@link Mono} that emits from the supplied {@link Mono}
*/
public final <V> Mono<V> then(Mono<V> other) {