'IntegrationFlow memory leak
I have two integration flows that get files from two different directories.
@Bean
public IntegrationFlow processBridgeFlow() {
return IntegrationFlows
.from(messageWaitingDirectory(), c -> c
.id("processFileRetry")
.autoStartup(false)
.poller(Pollers.fixedDelay(1000)))
.handle(inDirectory) //FileWritingMessageHandler
.get();
}
@Bean
public IntegrationFlow processMessage() {
return IntegrationFlows
.from(messageInDirectory(), c -> c
.id("processFile")
.autoStartup(false)
.poller(Pollers.fixedDelay(1000))
.advice((CustomAdvice) ctx.getBean("createLogAdvice", TYPE_NAME))
.errorChannel(errorMessageChannel())))
.publishSubscribeChannel(s -> s
.subscribe(f -> f.handle(SERVICE_NAME, "init"))
.subscribe(f -> f.handle(SERVICE_NAME, "processMessage"))
.subscribe(f -> f.handle(SERVICE_NAME, "end"))
.subscribe(f -> f.handle(destinationDirectory))) //FileWritingMessageHandler
.get();
}
@Bean
public MessageSource<File> messageWaitingDirectory() {
FileReadingMessageSource sourceReader = new FileReadingMessageSource();
sourceReader.setDirectory(new File(messagesProperties.getWaitingDirectory()));
sourceReader.setFilter(new RegexPatternFileListFilter(MESSAGE_FILE_PATTERN));
return sourceReader;
}
@Bean
public MessageSource<File> messageInDirectory() {
FileReadingMessageSource sourceReader = new FileReadingMessageSource();
sourceReader.setDirectory(new File(messagesProperties.getInDirectory()));
sourceReader.setFilter(new RegexPatternFileListFilter(MESSAGE_FILE_PATTERN));
sourceReader.setAutoCreateDirectory(false);
return sourceReader;
}
The visualVM reports shows that the memory consumption keep growing even if there is no file to consume. Here are screnshots on a few minutes without any file to consume : visualVM report VisualVM report object
How can I fix that ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
