本文整理汇总了Java中reactor.core.publisher.UnicastProcessor类的典型用法代码示例。如果您正苦于以下问题:Java UnicastProcessor类的具体用法?Java UnicastProcessor怎么用?Java UnicastProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnicastProcessor类属于reactor.core.publisher包,在下文中一共展示了UnicastProcessor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:reactor,项目名称:reactor-core,代码行数:21,代码来源:GuideTests.java
示例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();
}
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:25,代码来源:StatsdMeterRegistry.java
示例3: testUnicastDropPath
import reactor.core.publisher.UnicastProcessor; //导入依赖的package包/类
final Runnable testUnicastDropPath(OperatorScenario<I, PI, O, PO> scenario,
UnicastProcessor<I> up) {
return () -> {
if (up.actual() != null) {
up.actual()
.onError(exception());
//verify drop path
if (scenario.shouldHitDropErrorHookAfterTerminate()) {
up.actual()
.onComplete();
up.actual()
.onError(scenario.droppedError);
}
if (scenario.shouldHitDropNextHookAfterTerminate()) {
FluxFuseableExceptionOnPoll.next(up.actual(), scenario.droppedItem);
if (FluxFuseableExceptionOnPoll.shouldTryNext(up.actual())) {
FluxFuseableExceptionOnPoll.tryNext(up.actual(), scenario.droppedItem);
}
}
}
};
}
开发者ID:reactor,项目名称:reactor-core,代码行数:26,代码来源:BaseOperatorTest.java
示例4: 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();
}
开发者ID:reactor,项目名称:reactor-core,代码行数:15,代码来源:StepVerifierTests.java
示例5: 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();
}
开发者ID:reactor,项目名称:reactor-core,代码行数:14,代码来源:StepVerifierTests.java
示例6: 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));
}
开发者ID:reactor,项目名称:reactor-core,代码行数:8,代码来源:BaseOperatorTest.java
示例7: 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));
}
开发者ID:reactor,项目名称:reactor-core,代码行数:9,代码来源:BaseOperatorTest.java
示例8: 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));
}
开发者ID:reactor,项目名称:reactor-core,代码行数:11,代码来源:BaseOperatorTest.java
示例9: 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);
}
开发者ID:reactor,项目名称:reactor-core,代码行数:10,代码来源:BaseOperatorTest.java
示例10: 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));
}
开发者ID:reactor,项目名称:reactor-core,代码行数:11,代码来源:BaseOperatorTest.java
示例11: reset
import reactor.core.publisher.UnicastProcessor; //导入依赖的package包/类
public void reset() {
this.emitter = UnicastProcessor.<T>create().serialize();
this.sink = Flux.from(emitter).replay().autoConnect()
.take(Duration.ofSeconds(timeoutSeconds));
}
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:6,代码来源:MessageController.java
示例12: testUnicastSource
import reactor.core.publisher.UnicastProcessor; //导入依赖的package包/类
final void testUnicastSource(OperatorScenario<I, PI, O, PO> scenario,
UnicastProcessor<I> ts) {
fluxFuseableAsync(scenario).subscribe(ts);
}
开发者ID:reactor,项目名称:reactor-core,代码行数:5,代码来源:BaseOperatorTest.java
示例13: 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;
}
开发者ID:codecentric,项目名称:spring-boot-admin,代码行数:7,代码来源:ResubscribingEventHandlerTest.java
示例14: InstanceEventPublisher
import reactor.core.publisher.UnicastProcessor; //导入依赖的package包/类
protected InstanceEventPublisher() {
UnicastProcessor<InstanceEvent> unicastProcessor = UnicastProcessor.create();
this.publishedFlux = unicastProcessor.publish().autoConnect(0);
this.sink = unicastProcessor.sink();
}
开发者ID:codecentric,项目名称:spring-boot-admin,代码行数:6,代码来源:InstanceEventPublisher.java
注:本文中的reactor.core.publisher.UnicastProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论