Class MailStoreMonitor

All Implemented Interfaces:
Iterable<ComponentType>, Channel, ComponentType, Eligible, Manager

A component that opens mail stores and monitors mail folders for mails.

After establishing a connection to a store and selected folders (see onOpenMailMonitor(OpenMailMonitor, Channel)), the existing and all subsequently arriving mails will be sent downstream using MailFoldersUpdated events.

This implementation uses the IdleManager. The IdleManager works only if its IdleManager.watch(jakarta.mail.Folder) method is invoked (for a folder) after any operation on that folder. Note that operations such as e.g. setting the deleted flag of a message is also an operation on a folder.

Folders are updated in response to an UpdateMailFolders event or when the store signals the arrival of new messages. Information about the folders is delivered by a MailFoldersUpdated event. Folders may be freely used while handling the event, because the folders will be re-registered with the IdleManager when the MailFoldersUpdated event completes. Any usage of folders independent of handling the events mentioned will result in a loss of the monitor function.

If required, the monitor function may be reestablished any time by firing a UpdateMailFolders event for the folders used.