From 3fe874718db7a8955299fdf9eacb7d7a535ff946 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 11 Feb 2023 14:27:15 +0100 Subject: [PATCH] counter: 1.1.8 - Fixed a `ConcurentModificationException`-bug --- pom.xml | 2 +- .../kafka/wordcount/counter/CounterApplicationIT.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 87f1f77..93a541b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.juplo.kafka.wordcount counter - 1.1.7 + 1.1.8 Wordcount-Counter Word-counting stream-processor of the multi-user wordcount-example diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java index c6eb0a6..b412fe4 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/CounterApplicationIT.java @@ -60,7 +60,7 @@ public class CounterApplicationIT await("Expexted converted data") .atMost(Duration.ofSeconds(10)) - .untilAsserted(() -> TestData.assertExpectedResult(consumer.received)); + .untilAsserted(() -> TestData.assertExpectedResult(consumer.getReceivedMessages())); } @@ -70,11 +70,16 @@ public class CounterApplicationIT private final List received = new LinkedList<>(); @KafkaListener(groupId = "TEST", topics = TOPIC_OUT) - public void receive(ConsumerRecord record) + public synchronized void receive(ConsumerRecord record) { log.debug("Received message: {}", record); received.add(Message.of(record.key(),record.value())); } + + synchronized List getReceivedMessages() + { + return received; + } } @TestConfiguration -- 2.20.1