Spring Integration:聚合器将在超时时使消息过期

问题描述 投票:0回答:1

我正在使用SI的聚合器模式来保存事件并等待完成事件并将其存储在JdbcMessage存储中。我已经创建了表INT_MESSAGE,INT_MESSAGE_GROUP和INT_GROUP_TO_MESSAGE。

有时,完成事件可能不可用,我想完成并丢弃该事件,将其从表中删除。我不想桌子不必要地变大

我已经在管道中指定了以下配置

                        .expireGroupsUponCompletion(true)
                        .expireGroupsUponTimeout(true)
                        .groupTimeout(groupMessageTimeOut)
                        .sendPartialResultOnExpiry(false)

这将确保如果完成事件没有在x分钟内到达,则消息组将过期,在空通道中丢弃并从表中删除。

请提出建议。

spring-integration spring-integration-dsl
1个回答
0
投票

您的摘要是正确的。 .expireGroupsUponCompletion(true).expireGroupsUponTimeout(true)都从存储中删除了一个组。sendPartialResultOnExpiry(false)确实可以满足您的要求:

if (this.sendPartialResultOnExpiry) {
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Prematurely releasing partially complete group with key ["
                    + correlationKey + "] to: " + getOutputChannel());
        }
        completeGroup(correlationKey, group, lock);
    }
    else {
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Discarding messages of partially complete group with key ["
                    + correlationKey + "] to: "
                    + (this.discardChannelName != null ? this.discardChannelName : this.discardChannel));
        }
        if (this.releaseLockBeforeSend) {
            lock.unlock();
        }
        group.getMessages()
                .forEach(this::discardMessage);
    }

告诉我们,是什么让您对该配置感到困惑?

© www.soinside.com 2019 - 2024. All rights reserved.