Class MessageDeleteHandler

java.lang.Object
ch.tocco.nice2.messaging.mail.api.AbstractMailboxReaderHandler<ReaderResult>
ch.tocco.nice2.optional.mailintegration.impl.handler.MessageDeleteHandler
All Implemented Interfaces:
MailboxReaderHandler<ReaderResult>

public class MessageDeleteHandler extends AbstractMailboxReaderHandler<ReaderResult>
Can be used as last handler with CompositeMailReaderHandler that will set the Flags.Flag.DELETED flag on a message if the context contains a attribute.

Pre-executing handlers then set a flag on the MailboxReader.Context instead of on the message directly. This way deletion of message can be controlled by de/activating a handler which might be more convenient (e.g. no need to touch existing code).

  • Constructor Details

    • MessageDeleteHandler

      public MessageDeleteHandler()
  • Method Details

    • onMessage

      public void onMessage(jakarta.mail.Message message, MailboxReader.Context<ReaderResult> context) throws jakarta.mail.MessagingException
      Description copied from interface: MailboxReaderHandler
      Called for each message. The MessagingException is wrapped in a MailException to comply to the api of this module. All other execptions are propagated (wrapped in RuntimeException if necessary).
      Throws:
      jakarta.mail.MessagingException
    • createKey

      public static String createKey(jakarta.mail.Message message)