From: Kai Moritz Date: Sat, 2 Mar 2024 17:21:05 +0000 (+0100) Subject: test: HandoverIT-POC - FIX: `take(n)`, does end the work after n elements X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=7286776e39b3adcb3d8bff7e43d1b33305919ac2;p=demos%2Fkafka%2Fchat test: HandoverIT-POC - FIX: `take(n)`, does end the work after n elements * `take(n)` does end the execution. * `limitRate(n)` limits the rate of requested elements. --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestListener.java b/src/test/java/de/juplo/kafka/chat/backend/TestListener.java index e413c52d..35f65acd 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestListener.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestListener.java @@ -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) diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java index 8f7bc816..61516b0d 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java @@ -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)