spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

Provide access to stored messages from the ChannelMessageStore API

Open mrnst opened this issue 5 years ago • 1 comments

It should be possible to use the public API of ChannelMessageStore to get access to stored messages without consuming those messages.

The current implementation always yields an empty message group:

/**
 * Not fully used. Only wraps the provided group id.
 */
@Override
public MessageGroup getMessageGroup(Object groupId) {
    return getMessageGroupFactory().create(groupId);
}

mrnst avatar Nov 11 '20 21:11 mrnst

While implementing #3446 I've noticed that MongoDbChannelMessageStore extends AbstractConfigurableMongoDbMessageStore with its lazyLoadMessageGroups = true by default and give us a full access to the stored messages, either via getMessagesForGroup(Object groupId) or new streamMessagesForGroup(Object groupId).

So, we probably need just pull a couple MessageGroupStore method up into BasicMessageGroupStore or have their respective implementation in the ChannelMessageStore. And also revise a messageGroupFactory to be lazy for the JdbcChannelMessageStore and RedisChannelMessageStore, respectively.

Although it's probably still won't be so straightforward without any breaking changes. So, still 6.0.

artembilan avatar Jan 19 '21 23:01 artembilan