如何取消标记重复项以通过入站重新启动流,防止重复设置

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

问题是,在弹簧集成中,入站适配器有preventDuplicates(true),这是如何工作的?问题的原因是,如果流量中断并且在终端或中间服务激活器中引发的某些异常未完成,则入站应该能够再次进行此操作。

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

它默认配置一个AcceptOnceFileListFilter,它只能防止内存映射重复。

如果你明确地注入一个AcceptOnceFileListFilter(或者一个可以在持久存储中存储状态的FileSystemPersistentAcceptOnceFileListFilter),你可以调用remove() - 它们都实现了ResettableFileListFilter

/**
 * A {@link FileListFilter} that can be reset by removing a specific file from its
 * state.
 * @author Gary Russell
 * @since 4.1.7
 *
 */
public interface ResettableFileListFilter<F> extends FileListFilter<F> {

    /**
     * Remove the specified file from the filter so it will pass on the next attempt.
     * @param f the element to remove.
     * @return true if the file was removed as a result of this call.
     */
    boolean remove(F f);

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