test: HandoverIT-POC - FIX: `take(n)`, does end the work after n elements
authorKai Moritz <kai@juplo.de>
Sat, 2 Mar 2024 17:21:05 +0000 (18:21 +0100)
committerKai Moritz <kai@juplo.de>
Thu, 14 Mar 2024 08:11:21 +0000 (09:11 +0100)
* `take(n)` does end the execution.
* `limitRate(n)` limits the rate of requested elements.

src/test/java/de/juplo/kafka/chat/backend/TestListener.java
src/test/java/de/juplo/kafka/chat/backend/TestWriter.java

index e413c52..35f65ac 100644 (file)
@@ -51,10 +51,9 @@ public class TestListener
                     "Received a message from chat-room {}: {}",
                     chatRoom.getName(),
                     message);
-              })
-              .take(10);
+              });
         })
-        .take(100)
+        .limitRate(10)
         .takeUntil(message -> !running)
         .doOnComplete(() -> log.info("TestListener is done"))
         .parallel(chatRooms.length)
index 8f7bc81..61516b0 100644 (file)
@@ -63,6 +63,7 @@ public class TestWriter
               user,
               e.getResponseBodyAsString(Charset.defaultCharset()));
         })
+        .limitRate(1)
         .takeUntil(message -> !running)
         .doOnComplete(() -> log.info("TestWriter {} is done", user))
         .parallel(1)