Interface MailWorker

All Known Implementing Classes:
AbstractMailWorker, MailStoreWorker, NullMailWorker, WinmailWorker

public interface MailWorker
Classes that work on mails. This is very much like a Mailet.

Before reading any mails, the init(MailWorkerConfig) method is invoked on each worker.

On each new mail to process, the Matcher associated with each worker is asked whether the worker should process the mail. If true, a new MailWorkerContext is created and passed to the perform(IncomeMail, MailWorkerContext) method of each worker.

  • Method Details

    • init

      void init(MailWorkerConfig config)
      Called before any message is read.
    • perform

      void perform(IncomeMail mail, MailWorkerContext context)
      Called for each incoming mail. The context can be used for communication between workers. It is constructed at init(MailWorkerConfig) time and passed to each worker.

      This method is invoked during an open connection to the mailbox.

      This method may throw a runtime exception indicating a non-recoverable error. In this case remaining workers are not invoked and the mail is not deleted from the mailbox.

    • finish

      void finish(MailWorkerContext context)
      Called after all messages have been read.