2) On the receiver side (James) :
if(!alreadyExistsInPersistentStore(mail))
persist(mail);


There is no GUID for e-mail, so how would you implement that generically?
:-) But in a controlled environment, this is basically what I mentioned
last week.

Here's how I would implement the "alreadyExistsInPersistentStore(mail)" without GUID :

- An exact match on some canonical representation of a Mail (perhaps javax.mail.Message ?)

Now, one would ask : How can this be implemented cheaply ?

- With hashing :
i) store the mail in a DB table along with it's hash code
ii) alreadyExistsInPersistentStore(mail) would first retrieve from the DB all emails with the
same hash code, (the better the hash function, the fewer there will be), and then do an exact
comparison on all of them, returning true if it finds an exact match.

Note that this will eliminate mails that are an exact copy of a previously received mail, but
this is allowable for my app, its even desired behavior.

So if James can guaranty "at least once receival" (when sender is a "retry until acknowledge of success" like
most SMTP servers are), adding the simple algo above, in a mailet will give the "at most once",
the end result being "exactly once" delivery.

Is the assumption about James correct (that it cannot lose a mail provided that the sender retries until success) ?



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to