Let my clarify what I meant by 'guarantee of once and only once processing' :In general, how can one achieve guaranteed "once and only once" email receival with James ?I don't understand what "guaranteed once and only once email receival" is, James will receive a mail or not receive it.
If you mean how to ensure that a mailet will only every process a mail once it is not 100% possible.
There will always be a chance that a mail being processed when james is killed will be re-processed when it is re-started.
i) I need my app to "listen" for emails arriving via smtp, and store them in a database table
ii) I assume that mails are arriving from an SMTP relaying process (sendmail)
iii) I cannot assume that my James VM will not get restarted once in a while
iv) For the simplicity of this discussion, we will assume that the SMTP source
is absolutely reliable.
v) I need the guarantee that no mail loss can occur, and neither can duplicates
(every email arriving from sendmail will get processed once and only once,
no matter how often my James process gets restarted).
It seems from your answer that I have to add this fault tolerance, for James does not
have it build in.
Here's a sketch of the approach I'm considering :
1) Configure my sendmail 'source' to "retry upon failure". Lets say, upon failure,
retry every 5 minutes up to 10 times.
This solves the "at least once" part of the guarantee, but is likely to cause duplicates.
Now for the "at most once" guarantee :
2) Detect and ignore duplicates :
myRobustMailet.service(Mail m) {
if(isDuplicate(mail))
return;
put mail in DB;
}
Sendmail is irrelevant here, your mail client should connect straight to James, James is an SMTP Mail server too.In my case, my mail source is a sendmail instance, and the typical journey for emails today is typically
If you have to use sendmail for other reasons, fine, but it changes nothing, sendmail and James both know how to send and recieve mail properly. Any valid SMTP configuration of either will result in the correct transmission of your messages.
a serie of "store and forward" along a chain of relaying processes through SMTP, not all of them James instances (yet ;) ) !
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>