From 9832f61d2a0a8111f1773fdc29af40c15f580e70 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 4 Dec 2018 14:55:51 -0500 Subject: [PATCH] INT-4564: ACMH: Fix erroneous error log JIRA: https://jira.spring.io/browse/INT-4564 INT-4550 added an error log when multiple ACMHs were registered with the same store; the error log logic was incorrect and the error was logged when the first ACMH was registered. --- .../integration/store/AbstractMessageGroupStore.java | 2 +- .../aggregator/AbstractCorrelatingMessageHandlerTests.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java index 8b2a2e4520..db06edc676 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java @@ -112,7 +112,7 @@ public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageG this.expiryCallbacks.stream() .anyMatch(UniqueExpiryCallback.class::isInstance); - if (!uniqueExpiryCallbackPresent && this.logger.isErrorEnabled()) { + if (uniqueExpiryCallbackPresent && this.logger.isErrorEnabled()) { this.logger.error("Only one instance of 'UniqueExpiryCallback' can be registered in the " + "'MessageGroupStore'. Use a separate 'MessageGroupStore' for each aggregator/resequencer."); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandlerTests.java index c3c4501977..48ccab2acd 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandlerTests.java @@ -349,6 +349,8 @@ public class AbstractCorrelatingMessageHandlerTests { } }; handler.setMessageStore(messageStore); + // test UniqueExpiryCallback error message + // new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor()).setMessageStore(messageStore); handler.handleMessage(MessageBuilder.withPayload("foo") .setCorrelationId(1) .setSequenceNumber(1)