reactor.core.publisher.Flux.onBackpressureError()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中reactor.core.publisher.Flux.onBackpressureError()方法的一些代码示例,展示了Flux.onBackpressureError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flux.onBackpressureError()方法的具体详情如下:
包路径:reactor.core.publisher.Flux
类名称:Flux
方法名:onBackpressureError

Flux.onBackpressureError介绍

[英]Request an unbounded demand and push to the returned Flux, or emit onError fom Exceptions#failWithOverflow if not enough demand is requested downstream.
[中]请求一个无限制的需求并推送到返回的流量,或者如果下游请求的需求不足,则发出一个错误的fom异常#failWithOverflow。

代码示例

代码示例来源:origin: reactor/reactor-core

@Test
public void normalError() {
  AssertSubscriber<Integer> ts = AssertSubscriber.create();
  Flux.range(1, 10)
    .onBackpressureError()
    .subscribe(ts);
  ts.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
   .assertNoError()
   .assertComplete();
}

代码示例来源:origin: com.aol.cyclops/cyclops-reactor

/**
 * @return
 * @see reactor.core.publisher.Flux#onBackpressureError()
 */
public final Flux<T> onBackpressureError() {
  return boxed.onBackpressureError();
}
/**

代码示例来源:origin: io.projectreactor/reactor-netty

@Override
default ByteBufEncodedFlux receive() {
  return ByteBufEncodedFlux.encoded(receiveParts().onBackpressureError()
                          .concatMap(parts -> parts.aggregate()
                                       .retain())
                          .flatMap(bb ->
                              Flux.using(() -> bb,
                                  Flux::just,
                              ReferenceCounted::release)),
      delegate().alloc());
}

代码示例来源:origin: akarnokd/akarnokd-misc

onBackpressureError().
subscribeOn(Schedulers.newSingle("production")).
publishOn(Schedulers.elastic()).

代码示例来源:origin: akarnokd/akarnokd-misc

@Test
public void fluxCreateDemoElasticScheduler2() throws Exception {
  final int inputCount = 1000;
  TestSubscriber<Integer> ts = new TestSubscriber<>(0L);
  Flux.<Integer>create(
      sink -> {
        for (int i = 0; i < inputCount; i++) {
          //logger.info("Injecting {}", i);
          sink.next(i);
        }
        sink.complete();
      }).
      onBackpressureError().subscribe(ts);
  ts.assertNoValues()
  .assertError(IllegalStateException.class)
  .assertNotComplete();
}

相关文章

Flux类方法