WIP
[demos/kafka/chat] / src / test / java / de / juplo / kafka / chat / backend / TestWriter.java
index 559cd36..5c6f7ab 100644 (file)
@@ -9,6 +9,7 @@ import org.springframework.web.reactive.function.client.WebClient;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 import reactor.util.retry.Retry;
 
 import java.nio.charset.Charset;
@@ -20,12 +21,11 @@ import java.util.concurrent.ThreadLocalRandom;
 
 
 @Slf4j
-public class TestWriter implements Runnable
+public class TestWriter
 {
-  @Override
-  public void run()
+  public Mono<Void> run()
   {
-    Flux
+    return Flux
         .fromIterable((Iterable<Integer>) () -> new Iterator<>()
         {
           private int i = 0;
@@ -63,8 +63,9 @@ public class TestWriter implements Runnable
               user,
               e.getResponseBodyAsString(Charset.defaultCharset()));
         })
-        .then()
-        .block();
+        .parallel()
+        .runOn(Schedulers.parallel())
+        .then();
   }
 
   private Mono<MessageTo> sendMessage(