From e8f357749ac0872afab053bd979d58a422b69c13 Mon Sep 17 00:00:00 2001 From: Borahm Lee Date: Tue, 17 Sep 2024 00:22:50 +0900 Subject: [PATCH] Update `toSting()` methods in `KafkaEvent` subclasses (#3502) * Fix `toSting()` methods in `KafkaEvent` subclasses * Fix typo in `events.adoc` (cherry picked from commit c6cf896fb1191ba8f4fe8601276640f09d07a2cc) --- .../src/main/antora/modules/ROOT/pages/kafka/events.adoc | 2 +- .../kafka/event/ListenerContainerPartitionIdleEvent.java | 5 +++-- .../event/ListenerContainerPartitionNoLongerIdleEvent.java | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/events.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/events.adoc index 3d5f32ebac..bc4aefc6b8 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/events.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/events.adoc @@ -8,7 +8,7 @@ The following Spring application events are published by listener containers and * `ConsumerFailedToStartEvent`: published if no `ConsumerStartingEvent` is published within the `consumerStartTimeout` container property. This event might signal that the configured task executor has insufficient threads to support the containers it is used in and their concurrency. An error message is also logged when this condition occurs. -* `ListenerContainerIdleEvent`: published when no messages have been received in `idleInterval` (if configured). +* `ListenerContainerIdleEvent`: published when no messages have been received in `idleEventInterval` (if configured). * `ListenerContainerNoLongerIdleEvent`: published when a record is consumed after previously publishing a `ListenerContainerIdleEvent`. * `ListenerContainerPartitionIdleEvent`: published when no messages have been received from that partition in `idlePartitionEventInterval` (if configured). * `ListenerContainerPartitionNoLongerIdleEvent`: published when a record is consumed from a partition that has previously published a `ListenerContainerPartitionIdleEvent`. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionIdleEvent.java b/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionIdleEvent.java index 0b0249f117..7f94b6d6a9 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionIdleEvent.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionIdleEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ * is configured to do so. * * @author Tomaz Fernandes + * @author Borahm Lee * @since 2.7 */ public class ListenerContainerPartitionIdleEvent extends KafkaEvent { @@ -108,7 +109,7 @@ public boolean isPaused() { @Override public String toString() { - return "ListenerContainerIdleEvent [idleTime=" + return "ListenerContainerPartitionIdleEvent [idleTime=" + ((float) this.idleTime / 1000) + "s, listenerId=" + this.listenerId // NOSONAR magic # + ", container=" + getSource() + ", paused=" + this.paused diff --git a/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionNoLongerIdleEvent.java b/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionNoLongerIdleEvent.java index 385b6a4c32..03332d166c 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionNoLongerIdleEvent.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/event/ListenerContainerPartitionNoLongerIdleEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ * idle events. * * @author Gary Russell + * @author Borahm Lee * @since 2.6.2 */ public class ListenerContainerPartitionNoLongerIdleEvent extends KafkaEvent { @@ -92,9 +93,9 @@ public String getListenerId() { @Override public String toString() { - return "ListenerContainerNoLongerIdleEvent [idleTime=" + return "ListenerContainerPartitionNoLongerIdleEvent [idleTime=" + ((float) this.idleTime / 1000) + "s, listenerId=" + this.listenerId // NOSONAR magic # + ", container=" + getSource() - + ", topicPartitions=" + this.topicPartition + "]"; + + ", topicPartition=" + this.topicPartition + "]"; } }