Java Code Examples for reactor.core.publisher.WorkQueueProcessor#create()
The following examples show how to use
reactor.core.publisher.WorkQueueProcessor#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventSubscriptionManagerTest.java From sourcerer with MIT License | 5 votes |
@Test @Ignore // Manual only public void testBackpressureWorking() { EventRepository<String> repository = mock(EventRepository.class); EventSubscriptionPositionSource positionSource = mock(EventSubscriptionPositionSource.class); WorkQueueProcessor<EventSubscriptionUpdate<String>> processor = WorkQueueProcessor.create(); Flux<EventSubscriptionUpdate<String>> eventSource = Flux .fromStream(IntStream .range(0, 1000000) .mapToObj(this::wrapIntAsEvent) .map(EventSubscriptionUpdate::ofEvent)) .doOnNext(e -> { lastProducedValue = e.getEvent().getEvent(); }); eventSource.subscribe(processor); when(repository.getPublisher(any())).thenReturn(processor); when(positionSource.getSubscriptionPosition()).thenReturn(null); SlowSubscriptionHandler<String> subscriptionHandler = new SlowSubscriptionHandler<>(); EventSubscriptionManager subscriptionManager = new EventSubscriptionManager<>( repository, positionSource, subscriptionHandler, new SubscriptionWorkerConfig().withBatchSize(64)); SubscriptionToken token = subscriptionManager.start(); sleep(5000); token.stop(); logger.info( "Last produced value was {}, last seen {}, total events seen: {}", lastProducedValue, subscriptionHandler.getLastSeenValue(), subscriptionHandler.getTotalEvents()); }
Example 2
Source File: ReactorProxies.java From RHub with Apache License 2.0 | 4 votes |
public static ReactorProcProxy workQueueProcessorProxy() { return new ReactorProcProxy(WorkQueueProcessor.create(), PASS); }
Example 3
Source File: ReactorProxies.java From RHub with Apache License 2.0 | 4 votes |
public static ReactorProcProxy safeWorkQueueProcessorProxy() { return new ReactorProcProxy(WorkQueueProcessor.create(), WRAP); }