From: Kai Moritz Date: Sat, 11 Feb 2023 13:27:15 +0000 (+0100) Subject: counter: 1.1.8 - Fixed a `ConcurentModificationException`-bug X-Git-Tag: counter-1.1.8 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=3fe874718db7a8955299fdf9eacb7d7a535ff946;p=demos%2Fkafka%2Fwordcount counter: 1.1.8 - Fixed a `ConcurentModificationException`-bug --- 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