質問

Problem

I have a very basic configuration for a Spring integration mail adapter setup (below is the relevant sample):

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

<mail:inbound-channel-adapter id="popChannel"
  store-uri="pop3://user:password@domain.net/INBOX"
  channel="emailChannel"
  should-delete-messages="true"
  auto-startup="true">
  <int:poller max-messages-per-poll="1" fixed-rate="30000"/>
</mail:inbound-channel-adapter>

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

<int:service-activator input-channel="emailChannel" ref="mailResultsProcessor" method="onMessage" />

This is working fine the majority of the time and I can see the logs showing the polling (and it works fine hooking into my mailResultsProcessor when a mail is there):

2013-08-13 08:19:29,748 [task-scheduler-3] DEBUG org.springframework.integration.mail.Pop3MailReceiver - opening folder [pop3://user:password@fomain.net/INBOX]
2013-08-13 08:19:29,796 [task-scheduler-3] INFO  org.springframework.integration.mail.Pop3MailReceiver - attempting to receive mail from folder [INBOX]
2013-08-13 08:19:29,796 [task-scheduler-3] DEBUG org.springframework.integration.mail.Pop3MailReceiver - found 0 new messages
2013-08-13 08:19:29,796 [task-scheduler-3] DEBUG org.springframework.integration.mail.Pop3MailReceiver - Received 0 messages
2013-08-13 08:19:29,893 [task-scheduler-3] DEBUG org.springframework.integration.endpoint.SourcePollingChannelAdapter - Received no Message during the poll, returning 'false'

The problem I have is that the polling stops during the day, with no indication in the logs why it has stopped working. The only reason I can tell is the debug above is not present in the logs and E-Mails build up on the E-Mail account.

Questions

  • Has anyone seen this before and know how to resolve it?
  • Is there a change that I can make in my configuration to capture the issue into the log? I thought the logging channel adapter set to debug would have this covered.

Using version 2.2.3.RELEASE of Spring Integration on Tomcat 7, logs output default to catalina.out. Deployed on AWS standard tomcat 7 instance.

役に立ちましたか?

解決

Most likely the poller thread is hung someplace upstream. With your configuration, the next poll won't happen until the current poll completes.

You can use jstack or VisualVM to get a thread dump to find out what the thread is doing.

Another possibility is you are suffering from poller thread starvation - if you have a lot of other polled elements in your application, and depending on their configuration. The default taskScheduler bean has only 10 threads.

You can add a task executor to the <poller/> so each poll is handed off to another thread, but be aware that that can result in concurrent polls if a polled task takes longer to execute than the polling rate.

他のヒント

To resolve this problem specifically I used the configuration below:

<mail:inbound-channel-adapter id="popChannel"
      store-uri="pop3://***/INBOX"
      channel="emailChannel"
      should-delete-messages="true"
      auto-startup="true">
      <int:poller max-messages-per-poll="5" fixed-rate="60000" task-executor="pool"/>
</mail:inbound-channel-adapter>

<task:executor id="pool" pool-size="10" keep-alive="50"/>

Once moving to this approach we saw no further problems, and is with any use of pool the advantage is any Threads that become a problem are cleaned up and recreated.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top