INT-3876: Track groups in correlation endpoints

JIRA: https://jira.spring.io/browse/INT-3876

INT-3876 track groups ids in AbstractCorrelatingMessageHandler and docs

INT-3876 Fix merge conflict and add missing link in doc

INT-3876 Move groupId check in message group processor and rework on docs

INT-3876 Remove extra space from the doc

INT-3876 Fix checkstyle refer instance variable groupid correctly

INT-3876 Update aggregator doc with more details

* Polishing `aggregator.adoc`
* Rework `AbstractCorrelatingMessageHandlerTests.testDontReapMessageOfOtherHandler`
do not use redundant options
This commit is contained in:
Meherzad Lahewala
2017-11-20 14:50:39 -05:00
committed by Artem Bilan
parent f3072af192
commit 96aa7280a0
3 changed files with 45 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -52,6 +52,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
/**
* @author Gary Russell
* @author Artem Bilan
* @author Meherzad Lahewala
*
* @since 2.2
*
*/
@@ -417,4 +419,29 @@ public class AbstractCorrelatingMessageHandlerTests {
assertEquals(0, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size());
}
@Test
public void testDontReapMessageOfOtherHandler() throws Exception {
MessageGroupStore groupStore = new SimpleMessageStore();
AggregatingMessageHandler handler1 = new AggregatingMessageHandler(group -> group, groupStore);
AggregatingMessageHandler handler2 = new AggregatingMessageHandler(group -> group, groupStore);
QueueChannel handler1DiscardChannel = new QueueChannel();
handler1.setDiscardChannel(handler1DiscardChannel);
QueueChannel handler2DiscardChannel = new QueueChannel();
handler2.setDiscardChannel(handler2DiscardChannel);
handler1.setReleaseStrategy(group -> false);
handler2.setReleaseStrategy(group -> false);
handler1.handleMessage(MessageBuilder.withPayload("foo").setCorrelationId("foo").build());
handler1.handleMessage(MessageBuilder.withPayload("foo").setCorrelationId("foo").build());
handler2.handleMessage(MessageBuilder.withPayload("foo").setCorrelationId("bar").build());
groupStore.expireMessageGroups(0);
assertTrue(handler1DiscardChannel.getQueueSize() == 2);
assertTrue(handler2DiscardChannel.getQueueSize() == 1);
}
}