【发布时间】:2020-05-30 10:27:55
【问题描述】:
Flux 是否允许在不将指针指向初始位置的情况下对发生的异常重试操作?我的意思是从“有问题的”元素。
例如:
Flux.fromArray(new Integer[]{1, 2, 3})
.delayElements(Duration.ofSeconds(1))
.doOnNext(i -> {
System.out.println("i: " + i);
if (i == 2) {
System.out.println("2 found");
throw new RuntimeException("2!!!!!!!1");
}
})
.retry(2)
.subscribe();
会有以下输出:
i: 1
i: 2
2 found
i: 1
i: 2
2 found
i: 1
i: 2
2 found
当我希望看到这样的输出时:
i: 1
i: 2
2 found
i: 2
2 found
i: 2
2 found
附: skipUntil 不是我要找的东西
【问题讨论】: