Throttling during email processing
Email providers use throttling to control the number of email messages that they receive at one time. If the number of incoming email messages surpasses a certain threshold that is determined by the email provider, the email provider might invoke throttling and drop the connection or reject additional connections.
The way that Pega Platform identifies and handles throttling depends on whether you use the Microsoft Graph, IMAP, or POP3 protocols to receive emails. For all protocols, no messages are lost or duplicated during throttling.
Microsoft Graph sends an error code to Pega Platform when throttling occurs. The error code specifies the expected duration of the throttling. Throttling is also indicated by the Application is over its MailboxConcurrency limit error message in the log file. You can view the debug message this is throttling info for additional details, such as when the throttling occurred, the retry interval, and the email account that is throttled.
When an email listener receives the error, the listener stops reading emails on all nodes on which it is running. The system also pauses sending outgoing emails from the email account that is throttled.
The email listener continues to process emails that it already read before the throttling occurred. For example, if throttling occurs while an email listener creates a case from an email, the listener continues to create the case because the listener is not required to make calls to the email provider. The email listener resumes reading emails after the throttling period ends.
Email listeners follow the same behavior as described in the Microsoft Graph section. IMAP does not send an error code when throttling occurs. Throttling is indicated by the Email Account <accountName> is getting throttled by the mail provider error message, or the javax.mail.FolderClosedException error message in the log file. If the email listener encounters this message, the listener goes to sleep, and then wakes up after the latency period expires.
To help identify throttling, Pega Platform provides the Pega-IntegrationEngine Email_throttling_pattern_regex dynamic system setting. The setting uses a standard template to evaluate the pattern of an error message and determine whether the message is indicating throttling. If you are aware of other messages that might indicate throttling in your application, you can change the value of the dynamic system setting. For more information, see Editing a dynamic system setting.
The email listener skips email messages during throttling and attempts to process the messages again the next time the listener wakes up.
ArticleCreating an email listener