Package ch.astorm.smtp4j.core
Interface SmtpMessageHandler
- All Superinterfaces:
SmtpServerListener
- All Known Implementing Classes:
DefaultSmtpMessageHandler
Represents a message handler that will process any incoming message.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a simpleSmtpMessageiterator. -
Method Summary
Modifier and TypeMethodDescriptionReturns a newSmtpMessageReaderthat loops over the received messages.readMessages(long delayIfNoMessage, TimeUnit unit) Retrieves the received messages and clears the list.Methods inherited from interface ch.astorm.smtp4j.core.SmtpServerListener
notifyClose, notifyMessage, notifyStart
-
Method Details
-
messageReader
SmtpMessageHandler.SmtpMessageReader messageReader()Returns a newSmtpMessageReaderthat loops over the received messages. Note that if you create multipleSmtpMessageReaderinstances, the will compete over the same message list and the messages will be received only by one of the readers.- Returns:
- A new
SmtpMessageReaderinstance.
-
readMessages
Retrieves the received messages and clears the list. In case there are already some messages returned, this method returns them immediately without waiting.- Parameters:
delayIfNoMessage- The delay to wait when there is no message yet received or a negative value to avoid any wait.unit- The unit of thedelayIfNoMessage.- Returns:
- All the (newly) received messages or an empty list if none.
-