From 1d7eef985c801d0a0fbb9b60cb7015b4e559aed9 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Mar 2024 18:21:05 +0100 Subject: [PATCH] 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. --- src/test/java/de/juplo/kafka/chat/backend/TestListener.java | 5 ++--- src/test/java/de/juplo/kafka/chat/backend/TestWriter.java | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) 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) -- 2.20.1