Mail Listener / IMAP: Reconnect strategy Follow
This article describes advanced ServiceManager configurations on a pre-configured IMAP listener .
For instructions on setting up your IMAP listener, please see the following articles:
Gmail accounts: https://auraplayer.zendesk.com/hc/en-us/articles/8377976678295
Office 365 accounts: https://auraplayer.zendesk.com/hc/en-us/articles/10990322241559
What is the mail listener?
Some ServiceManager features might require listening for incoming email: for example, Email RPAs trigger an RPA when an email having a specific pattern is received.
The mail listener is responsible for receiving email messages in real time and routing them within the ServiceManager,
Notice: this is only relevant for receiving mail on the ServiceManager side (not sending).
Keeping the connection alive
The ServiceManager periodically sends a NOOP (No-Op) command to the mail server, to let the mail server know to keep the connection alive.
The following system property sets the frequency of these NOOP commands:
IMAP_MAIL_LISTENER_NOOP_FREQUENCY_MIN = 25
(set to 0 to disable sending NOOPs)
Reconnecting when the connection drops
Even with the NOOP mechanism, the mail connection might drop from time to time:
- The mail listener is a real time active connection and therefore momentary network connection drops or other interruptions are more noticeable.
- In addition, the mail server (Microsoft, Gmail, etc) might decide to close the connection and expect you to refresh the connection from time to time for various reasons.
The ServiceManager will try to reconnect (multiple times) when mail connection issues happen.
Ideally, it will succeed on the first attempt, but it might require multiple attempts to re-establish the mail connection. This behavior can be controlled via the system properties described bellow.
Reconnect strategy 1: fixed intervals
One approach is to wait a fixed amount of milliseconds between reconnection attempts.
This is simple to understand and works best when the connection is likely to recover fast.
Reconnect strategy 2: exponentially growing intervals
A more advanced approach, which is more resilient for prolonged connection issues, is to wait a short time before the 2nd reconnection attempt, wait a longer interval before the 3rd reconnection attempt, an even longer time before the 4th attempt, etc.
In this case, the interval between reconnection attempts are exponentially growing.
System Properties: IMAP reconnection strategy
The first attempt to reconnect will happen immediately after the mail listener connection drops.
The following values configure what happens on the 2nd, 3rd, 4th (and etc) connection attempts.
Property key | Description | Default value |
IMAP_MAIL_LISTENER_RECONNECT_DELAY_MS |
(miliseconds) Time to wait between reconnection attempts. |
1000 |
IMAP_MAIL_LISTENER_RECONNECT_ |
(double, can be fractional) |
1 With RECONNECT_DELAY_MS = 1000, EXPONENTIAL_DELAY_GROWTH = 1, the reconnection intervals will be: 1) 1000 * (1+1)0 = 1000 ms = 1sec 2) 2000 * (1+1)1 = 1000 ms = 2sec 3) 4sec 4) 8sec … 11) 2048 sec = 34 minutes 12) 4096 sec = 68 minutes |
IMAP_MAIL_LISTENER_RECONNECT_ATTEMPTS
|
Number of times that the Mail Listener will try to reconnect. Afterwards, it won’t reconnect again until manually restarted (via Admin > Mail Config > Save). |
12 |
Comments
0 comments
Please sign in to leave a comment.