GH-8773: Fix MGS for removal from group
Fixes https://github.com/spring-projects/spring-integration/issues/8773 The https://github.com/spring-projects/spring-integration/issues/8732 introduced a filtering for messages in group. So, plain `removeMessage()` doesn't work any more if message is connected to some group yet. Therefore, `DelayHandler` is failing. * Introduce `getMessageFromGroup()` and `removeMessageFromGroupById()` into `MessageGroupStore` API and implement it respectively in all the stores * Remove `@LongRunningTest` from delayer integration tests and adjust its config to delay not for a long **Cherry-pick to `6.1.x`** # Conflicts: # spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
<beans:bean id="messageStore" class="org.springframework.integration.redis.store.RedisMessageStore">
|
||||
<beans:constructor-arg
|
||||
value="#{T (org.springframework.integration.redis.RedisContainerTest).connectionFactory()}"/>
|
||||
value="#{T (org.springframework.integration.redis.RedisContainerTest).connectionFactory() }"/>
|
||||
</beans:bean>
|
||||
|
||||
<channel id="output">
|
||||
@@ -17,7 +17,7 @@
|
||||
<delayer id="#{T (org.springframework.integration.redis.store.DelayerHandlerRescheduleIntegrationTests).DELAYER_ID}"
|
||||
input-channel="input"
|
||||
output-channel="output"
|
||||
default-delay="5000"
|
||||
default-delay="1000"
|
||||
message-store="messageStore"/>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2023 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.
|
||||
@@ -29,14 +29,12 @@ import org.springframework.integration.redis.RedisContainerTest;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.test.condition.LongRunningTest;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
@@ -45,8 +43,8 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
@LongRunningTest
|
||||
class DelayerHandlerRescheduleIntegrationTests implements RedisContainerTest {
|
||||
|
||||
public static final String DELAYER_ID = "delayerWithRedisMS" + UUID.randomUUID();
|
||||
|
||||
@Test
|
||||
@@ -73,15 +71,6 @@ class DelayerHandlerRescheduleIntegrationTests implements RedisContainerTest {
|
||||
assertThat(taskScheduler.getScheduledExecutor().awaitTermination(10, TimeUnit.SECONDS)).isTrue();
|
||||
context.close();
|
||||
|
||||
try {
|
||||
context.getBean("input", MessageChannel.class);
|
||||
fail("IllegalStateException expected");
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertThat(e).isInstanceOf(IllegalStateException.class);
|
||||
assertThat(e.getMessage()).contains("BeanFactory not initialized or already closed - call 'refresh'");
|
||||
}
|
||||
|
||||
assertThat(messageStore.getMessageGroupCount()).isEqualTo(1);
|
||||
assertThat(messageStore.iterator().next().getGroupId()).isEqualTo(delayerMessageGroupId);
|
||||
assertThat(messageStore.messageGroupSize(delayerMessageGroupId)).isEqualTo(2);
|
||||
|
||||
Reference in New Issue
Block a user