本文整理汇总了Java中reactor.core.publisher.UnicastProcessor.create方法的典型用法代码示例。如果您正苦于以下问题:Java UnicastProcessor.create方法的具体用法?Java UnicastProcessor.create怎么用?Java UnicastProcessor.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reactor.core.publisher.UnicastProcessor
的用法示例。
在下文中一共展示了UnicastProcessor.create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: advancedHot
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
@Test
public void advancedHot() {
UnicastProcessor<String> hotSource = UnicastProcessor.create();
Flux<String> hotFlux = hotSource.publish()
.autoConnect()
.map(String::toUpperCase);
hotFlux.subscribe(d -> System.out.println("Subscriber 1 to Hot Source: "+d));
hotSource.onNext("blue");
hotSource.onNext("green");
hotFlux.subscribe(d -> System.out.println("Subscriber 2 to Hot Source: "+d));
hotSource.onNext("orange");
hotSource.onNext("purple");
hotSource.onComplete();
}
示例2: StatsdMeterRegistry
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
public StatsdMeterRegistry(StatsdConfig config, HierarchicalNameMapper nameMapper, Clock clock) {
super(clock);
this.statsdConfig = config;
this.nameMapper = ofNullable(nameMapper).orElse(HierarchicalNameMapper.DEFAULT);
switch (statsdConfig.flavor()) {
case Datadog:
config().namingConvention(NamingConvention.dot);
break;
case Telegraf:
config().namingConvention(NamingConvention.snakeCase);
break;
default:
config().namingConvention(NamingConvention.camelCase);
}
this.publisher = UnicastProcessor.create(Queues.<String>get(statsdConfig.queueSize()).get());
gauge("statsd.queue.size", this.publisher, UnicastProcessor::size);
gauge("statsd.queue.capacity", this.publisher, UnicastProcessor::getBufferSize);
if (config.enabled())
start();
}
示例3: takeAsyncFusedBackpressured
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
@Test
public void takeAsyncFusedBackpressured() {
UnicastProcessor<String> up = UnicastProcessor.create();
StepVerifier.create(up.take(3), 0)
.expectFusion()
.then(() -> up.onNext("test"))
.then(() -> up.onNext("test"))
.then(() -> up.onNext("test"))
.thenRequest(2)
.expectNext("test", "test")
.thenRequest(1)
.expectNext("test")
.verifyComplete();
}
示例4: cancelAsyncFusion
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
@Test
public void cancelAsyncFusion() {
UnicastProcessor<String> up = UnicastProcessor.create();
StepVerifier.create(up.take(3), 0)
.expectFusion()
.then(() -> up.onNext("test"))
.then(() -> up.onNext("test"))
.then(() -> up.onNext("test"))
.thenRequest(2)
.expectNext("test", "test")
.thenCancel()
.verify();
}
示例5: inputFusedAsyncOutputFusedAsync
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
final StepVerifier.Step<O> inputFusedAsyncOutputFusedAsync(OperatorScenario<I, PI, O, PO> scenario) {
UnicastProcessor<I> up = UnicastProcessor.create();
return StepVerifier.create(scenario.body()
.apply(withFluxSource(up)))
.expectFusion(Fuseable.ASYNC)
.then(() -> testUnicastSource(scenario, up));
}
示例6: inputFusedAsyncOutputFusedAsyncConditional
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
final StepVerifier.Step<O> inputFusedAsyncOutputFusedAsyncConditional(OperatorScenario<I, PI, O, PO> scenario) {
UnicastProcessor<I> up = UnicastProcessor.create();
return StepVerifier.create(scenario.body()
.andThen(this::conditional)
.apply(withFluxSource(up)))
.expectFusion(Fuseable.ASYNC)
.then(() -> testUnicastSource(scenario, up));
}
示例7: inputFusedError
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
final StepVerifier.Step<O> inputFusedError(OperatorScenario<I, PI, O, PO> scenario) {
UnicastProcessor<I> up = UnicastProcessor.create();
return StepVerifier.create(scenario.body()
.apply(up.as(f -> withFluxSource(new FluxFuseableExceptionOnPoll<>(
f,
exception())))))
.then(testUnicastDropPath(scenario, up));
}
示例8: inputFusedAsyncErrorOutputFusedAsync
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
final StepVerifier.Step<O> inputFusedAsyncErrorOutputFusedAsync(OperatorScenario<I, PI, O, PO> scenario) {
UnicastProcessor<I> up = UnicastProcessor.create();
up.onNext(item(0));
return StepVerifier.create(scenario.body()
.apply(up.as(f -> withFluxSource(new FluxFuseableExceptionOnPoll<>(
f,
exception())))))
.expectFusion(scenario.fusionMode() & ASYNC);
}
示例9: inputFusedErrorOutputFusedConditional
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
final StepVerifier.Step<O> inputFusedErrorOutputFusedConditional(OperatorScenario<I, PI, O, PO> scenario) {
UnicastProcessor<I> up = UnicastProcessor.create();
return StepVerifier.create(scenario.body()
.andThen(this::conditional)
.apply(up.as(f -> withFluxSource(new FluxFuseableExceptionOnPoll<>(
f,
exception())))))
.then(testUnicastDropPath(scenario, up));
}
示例10: TestEventHandler
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
protected TestEventHandler(Publisher<InstanceEvent> publisher) {
super(publisher, InstanceRegisteredEvent.class);
UnicastProcessor<InstanceEvent> processor = UnicastProcessor.create();
this.sink = processor.sink();
this.flux = processor;
}
示例11: InstanceEventPublisher
import reactor.core.publisher.UnicastProcessor; //导入方法依赖的package包/类
protected InstanceEventPublisher() {
UnicastProcessor<InstanceEvent> unicastProcessor = UnicastProcessor.create();
this.publishedFlux = unicastProcessor.publish().autoConnect(0);
this.sink = unicastProcessor.sink();
}