Skip to content

DelayHandler, ConfigurableMongoDbMessageStore and PersistentMessageGroup issue at startup/load #3446

@juanavelez

Description

@juanavelez

In what version(s) of Spring Integration are you seeing this issue?

5.3.1.RELEASE

Describe the bug

If you have set up a DelayHandler using a ConfigurableDbMessageStore and the MongoDB collection behind it is very big (e.g. 1M records), upon startup the DelayHandler will try to re-schedule all messages in the delay store. Because we are using ConfigurableDbMessageStore which extends AbstractMessageGroupStore and also lazyLoadMessageGroups, this class, sets the persistentMessageGroupFactory as a SimpleMessageGroupFactory(SimpleMessageGroupFactory.GroupType.PERSISTENT) which returns PersistentMessageGroup. When the PersistentMessageGroup is called to retrieve the messages, it loads ALL messages in memory before returning the iterator

private final class PersistentCollection extends AbstractCollection<Message<?>> {

this.collection = PersistentMessageGroup.this.messageGroupStore.getMessagesForGroup(groupId);

MessageGroup messageGroup = this.messageStore.getMessageGroup(this.messageGroupId);

Depending on the available memory, OOM happens.

To Reproduce

Create a collection behind the DelayHandler/ConfigurableDbMessageStore and load it with millions of records. Start an application that makes use of the DelayHandler

Expected behavior

We believe it is OK to reschedule messages upon startup but not loading them all at once in memory. Maybe doing it via MongoDB streaming API?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions