Spring Integration组 - 超时澄清

时间:2018-02-26 17:17:38

标签: spring-integration

准确地说,如果我在spring集成聚合器上配置组超时,实际发生的情况是,当发生超时时,它只会导致再次调用ReleaseStrategy方法,我必须在该ReleaseStrategy调用中做出决定如果我想发布或不发布?

1 个答案:

答案 0 :(得分:2)

Correct, the function is called forceComplete() and the logic is like this:

if (this.releaseStrategy.canRelease(groupNow)) {
    completeGroup(correlationKey, groupNow);
}
else {
    expireGroup(correlationKey, groupNow);
}

So, actually your release strategy might still be false-positive, just because it is really designed for fully formed groups. In theory. But you can pay attention to the sendPartialResultOnExpiry = true option, in which case in the expireGroup() we have:

if (this.sendPartialResultOnExpiry) {
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Prematurely releasing partially complete group with key ["
                    + correlationKey + "] to: " + getOutputChannel());
        }
        completeGroup(correlationKey, group);
    }