stegada
stegada

Reputation: 289

Spring Integration - Delay poller for mail inbound channel adapter not considered


I've configured an inbound-channel-adapter to receive mail and i set up a poller with fixed-delay = 15000.
When max-messages-per-poll is set to low value (less than the number of messages in the mailbox folder), the trigger fires correctly every 15 seconds.
But if max-messages-per-poll is set to a high value, Pop3MailReceiver is called every about 2 seconds and fixed-delay or cron settings are not considered.
Where is my fault?
Thanks in advance for your help.

<util:properties id="javaMailProperties">
    <prop key="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    <prop key="mail.pop3.socketFactory.fallback">false</prop>
    <prop key="mail.store.protocol">pop3s</prop>
</util:properties>

<mail:inbound-channel-adapter id="mailAdapter"
              store-uri="pop3s://xxxxxxxxxx%40xxxxxxxxx.xxxxx:xxxxxxxxx@xxxxxxx:xxx/inbox"
              channel="receiveEmailChannel"
              should-delete-messages="false"
              java-mail-properties="javaMailProperties"
              auto-startup="false">
        <int:poller max-messages-per-poll="10" fixed-delay="15000"/>
</mail:inbound-channel-adapter>

<int:control-bus input-channel="receiveEmailChannel"/>

<int:channel id="receiveEmailChannel">
    <int:interceptors>
        <int:wire-tap channel="logger"/>
    </int:interceptors>
</int:channel>

<int:logging-channel-adapter id="logger" level="DEBUG"/>

<int:service-activator input-channel="receiveEmailChannel" ref="mailNotificationDetector" method="receive"/>

Upvotes: 2

Views: 2177

Answers (1)

Biju Kunjummen
Biju Kunjummen

Reputation: 49915

From the documentation it sounds like this is the expected behavior, polling will be done repeatedly until the max-messages-per-poll number is satisfied.

So when you had a low max-messages-per-poll, this number was satisfied by a few polling calls which probably got completed fairly quickly and you could see a clean fixed-delay call. When you had a high max-messages-per-poll, it took probably quite a few poll calls to satisfy the max-messages-per-poll call.

Upvotes: 2

Related Questions