org.springframework.integration.adapter.mail.monitor
Interface MonitoringStrategy

All Known Implementing Classes:
AbstractMonitoringStrategy, ImapIdleMonitoringStrategy, PollingMonitoringStrategy, Pop3PollingMonitoringStrategy

public interface MonitoringStrategy

Defines the contract for objects that monitor a given folder for new messages. Allows for multiple implementation strategies, including polling, or event-driven techniques such as IMAP's IDLE command.

Author:
Arjen Poutsma

Method Summary
 int getFolderOpenMode()
          Returns the folder open mode to be used by this strategy.
 javax.mail.Message[] receive(javax.mail.Folder folder)
          Monitors the given folder, and returns any new messages when they arrive.
 

Method Detail

receive

javax.mail.Message[] receive(javax.mail.Folder folder)
                             throws javax.mail.MessagingException,
                                    java.lang.InterruptedException
Monitors the given folder, and returns any new messages when they arrive.

Parameters:
folder - the folder in which to look for new messages
Returns:
the new messages
Throws:
javax.mail.MessagingException - in case of JavaMail errors
java.lang.InterruptedException - if a thread is interrupted

getFolderOpenMode

int getFolderOpenMode()
Returns the folder open mode to be used by this strategy. Can be either Folder.READ_ONLY or Folder.READ_WRITE.