Class MailProcessorHandler
java.lang.Object
ch.tocco.nice2.messaging.mail.api.AbstractMailboxReaderHandler<ReaderResult>
ch.tocco.nice2.optional.mailintegration.impl.handler.MailProcessorHandler
- All Implemented Interfaces:
MailboxReaderHandler<ReaderResult>
Gets the
IncomeMail
object from the context and feeds in into the MailProcessor
. If
this was successful, the message is marked for deletion so it is removed from the inbox after the
reader completes. The message is only deleted, if MessageDeleteHandler
is configured as
the last MailboxReaderHandler
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
finish
(MailboxReader.Context<ReaderResult> context) Called once after iterating finished, regardless of error.void
init
(MailboxReader.Context<ReaderResult> context) Called once before the reading process starts.void
onMessage
(jakarta.mail.Message message, MailboxReader.Context<ReaderResult> context) Called for each message.void
setExceptionHandler
(ExceptionHandler<IncomeMail> exceptionHandler)
-
Constructor Details
-
MailProcessorHandler
-
-
Method Details
-
setExceptionHandler
-
init
Description copied from interface:MailboxReaderHandler
Called once before the reading process starts.- Specified by:
init
in interfaceMailboxReaderHandler<ReaderResult>
- Overrides:
init
in classAbstractMailboxReaderHandler<ReaderResult>
-
finish
Description copied from interface:MailboxReaderHandler
Called once after iterating finished, regardless of error.- Specified by:
finish
in interfaceMailboxReaderHandler<ReaderResult>
- Overrides:
finish
in classAbstractMailboxReaderHandler<ReaderResult>
-
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. TheMessagingException
is wrapped in aMailException
to comply to the api of this module. All other execptions are propagated (wrapped inRuntimeException
if necessary).- Throws:
jakarta.mail.MessagingException
-