GH-3619: Fix Mail Receiver fetch redundant Messages

Fixes https://github.com/spring-projects/spring-integration/issues/3619

The `AbstractMailReceiver` fetche redundant messages, causing performance problems

* Use correct, already filtered, array of message to fetch

**Cherry-pick to `main` & `5.3.x`**
This commit is contained in:
wangYX657211334
2021-09-02 22:48:29 +08:00
committed by GitHub
parent 43cb48443f
commit 9f426500a1

View File

@@ -65,6 +65,7 @@ import org.springframework.util.MimeTypeUtils;
* @author Gary Russell
* @author Artem Bilan
* @author Dominik Simmen
* @author Yuxin Wang
*/
public abstract class AbstractMailReceiver extends IntegrationObjectSupport implements MailReceiver, DisposableBean {
@@ -413,7 +414,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl
}
this.logger.debug(() -> "found " + messagesToProcess.length + " new messages");
if (messagesToProcess.length > 0) {
fetchMessages(messages);
fetchMessages(messagesToProcess);
}
this.logger.debug(() -> "Received " + messagesToProcess.length + " messages");