chibenwa commented on PR #2486:
URL: https://github.com/apache/james-project/pull/2486#issuecomment-2457737941

   ```
       private Sinks.Many<Integer> objectMany;
       private CountDownLatch countDownLatch;
   
       @Test
       void test() throws Exception {
           countDownLatch = new CountDownLatch(1);
           objectMany = Sinks.many().multicast().onBackpressureBuffer();
           objectMany.asFlux()
               .subscribeOn(Schedulers.parallel())
               .subscribe(i -> Mono.delay(Duration.ofMillis(1))
                   .doFinally(any -> betise(i))
                   .subscribe());
           objectMany.emitNext(1, Sinks.EmitFailureHandler.FAIL_FAST);
           countDownLatch.await();
       }
   
       void betise(int i) {
           if (i < 20000) {
               System.out.println(i);
               objectMany.emitNext(i + 1, Sinks.EmitFailureHandler.FAIL_FAST);
           } else {
               countDownLatch.countDown();
           }
       }
   ```
   
   Using signaling technics apparently do avoid the effect mentioned in 
https://github.com/apache/james-project/pull/2486#issuecomment-2457568663


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to