One of our clients asked us to build a process that would extract information from messages arriving at a given email inbox, transform it, and write it to a data model. We haven't posted anything about the Continual Processing toolkit yet, but it's a good fit for this kind of thing – except that we didn't have an email reading input channel yet!

The Continual Processing system allows you to configure event processing chains in which data from a given source is run through transform rules and optionally sent to one or more sinks.

To complete this task, we'd need a source that we could configure to read an IMAP folder, translate each new message into an internal event, and then use our model toolset to update the client's model.

Starting with Continual build 0.2.29, we'll include ImapMailboxMonitor, which you can configure as follows:

    "class": "",
    "mailImapServer": "",
    "mailLogin": "",
    "mailPassword": "${MY_MAIL_PASSWORD}",
    "folder": "inbox",
    // optional
    "pollEveryMins": 5,
    // our class needs to note its high-water mark persistently
        "class": "",
        "file": "./data/inboxTrack.txt"

This source component reads the designated folder periodically. (The javax.mail IMAP watch functionality seemed flakey, and we don't have near-real-time requirements, so polling works well enough for now.)  When an email arrives, it's converted into a Processing message and handed off to the configured processing pipeline.