简体   繁体   中英

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

Even though I configured the scheduler pool size as 5 , sometimes it's not reading all the mails are received in the inbox.

@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();
}

There is no reason to use QueueChannel , if you already have an Inbound Channel Adapter. Also: consider to use a imapIdleAdapter() instead. Probably those 5 in the pool for scheduler is still not enough: just because you have too many scheduler-based tasks: inbound channel adapters and queue channels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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