Spring integration 为POP3访问配置的Spring集成邮件入站通道适配器两次拉取相同的电子邮件

Spring integration 为POP3访问配置的Spring集成邮件入站通道适配器两次拉取相同的电子邮件,spring-integration,Spring Integration,我有一个Spring集成邮件入站适配器,配置为轮询POP3电子邮件收件箱,以处理带有大型XML文件附件的传入电子邮件。配置如下: <int:channel id="emailInputChannel"/> <int-mail:inbound-channel-adapter id="pop3EmailAdapter" store-uri="pop3://${pop3.user}:${pop3.pwd}@${pop3.server.host}/Inbox"

我有一个Spring集成邮件入站适配器,配置为轮询POP3电子邮件收件箱,以处理带有大型XML文件附件的传入电子邮件。配置如下:

    <int:channel id="emailInputChannel"/> 
    <int-mail:inbound-channel-adapter id="pop3EmailAdapter" store-uri="pop3://${pop3.user}:${pop3.pwd}@${pop3.server.host}/Inbox" 
    channel="emailInputChannel" should-delete-messages="true" auto-startup="true" java-mail-properties="javaMailProperties">               
<int:poller max-messages-per-poll="1" fixed-rate="${email.poller.rate}" />
    </int-mail:inbound-channel-adapter>

    <!-- Java Mail POP3 properties -->
    <util:properties id="javaMailProperties">
      <beans:prop key="mail.debug">true</beans:prop> 
      <beans:prop key="mail.pop3.port">${pop3.server.port}</beans:prop> 
    </util:properties>

有没有办法限制适配器只使用一个轮询器而不是默认的多个轮询器?如果是这样,请提供一个示例,说明如何仅使用一个轮询器设置入站邮件适配器。

固定延迟
适用于您。从
PeriodicTrigger
JavaDocs:

 * To measure the interval between the
 * scheduled <emphasis>start</emphasis> time of each execution instead, set the
 * 'fixedRate' property to {@code true}.

由于
TaskScheduler
依赖于要调度的任务的日期事实,因此只有
固定延迟
才能达到
单线程
要求。下一个轮询任务将在上一个轮询任务完成后启动。

非常感谢。我会试试这个。我还尝试了另一种方法,该方法需要对SI配置进行以下更改。不适合评论。请编辑您的问题以使其更清晰易懂基本上,我定义了一个池大小为1的任务执行者。这是一种有效的方法吗?基本上,我定义了一个池大小为1的任务执行器。这是一种有效的方法吗<代码>
 * To measure the interval between the
 * scheduled <emphasis>start</emphasis> time of each execution instead, set the
 * 'fixedRate' property to {@code true}.
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
    if (triggerContext.lastScheduledExecutionTime() == null) {
        return new Date(System.currentTimeMillis() + this.initialDelay);
    }
    else if (this.fixedRate) {
        return new Date(triggerContext.lastScheduledExecutionTime().getTime() + this.period);
    }
    return new Date(triggerContext.lastCompletionTime().getTime() + this.period);
}