繁体   English   中英

通过对 IntegrationFlows.from(Mail) 使用多个 mailId,未阅读收件箱中的所有邮件

[英]Not reading all mails are in the inbox by using multiple mailIds for IntegrationFlows .from(Mail

即使我将调度程序池大小配置为5 ,有时它也不会读取收件箱中收到的所有邮件。

@Bean
public IntegrationFlow customerCareMailFlow() {
    return IntegrationFlows.from(Mail
        .imapInboundAdapter("imap://" + property.getCustomerCareUserName() + ":"
            + property.getCustomerCarePassword() + "@" + property.getHost() + ":"
            + property.getPort() + "/INBOX")
                .searchTermStrategy(this::generateSearchTerm).shouldMarkMessagesAsRead(true)
                .userFlag("testSIUserFlag").simpleContent(true)
                .javaMailProperties(p -> p.put(property.getMailDebugKey(), property.getMailDebugValue())
                .put(property.getMailImapSSLEnableKey(), property.getMailImapSSLEnableValue())),
                e -> e.autoStartup(true).poller(p -> p.fixedRate(1000)))
                    .channel(MessageChannels.queue(property.getCustomerCareChannelName()))
    .get();
}

@Bean
public IntegrationFlow serviceDeskMailFlow() {
    return IntegrationFlows
        .from(Mail.imapInboundAdapter(
            "imap://" + property.getServiceDeskUserName() + ":" + property.getServiceDeskPassword()
                + "@" + property.getHost() + ":" + property.getPort() + "/INBOX")
                .searchTermStrategy(this::generateSearchTerm).shouldMarkMessagesAsRead(true)
                .userFlag("testSIUserFlag").simpleContent(true)
                .javaMailProperties(p -> p.put(property.getMailDebugKey(), property.getMailDebugValue())
                .put(property.getMailImapSSLEnableKey(), property.getMailImapSSLEnableValue())),
            e -> e.autoStartup(true).poller(p -> p.fixedRate(1000)))
                .log(e -> e.getPayload())
                .channel(MessageChannels.queue(property.getServiceDeskChannelName()))
    .get();
}

如果您已经有入站通道适配器,则没有理由使用QueueChannel 另外:考虑改用imapIdleAdapter() 调度器池中的这5可能仍然不够:只是因为您有太多基于调度器的任务:入站通道适配器和队列通道。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM