[ZODB-Dev] Re: afterCommitHook

Jim Fulton jim at zope.com
Thu Sep 22 11:31:42 EDT 2005


Florent Guillaume wrote:
> Dieter Maurer  <dieter at handshake.de> wrote:
> 
>>Victor Safronovich wrote at 2005-9-21 17:19 +0600:
>>
>>>...
>>>I used a MailHost product for e-mail notifications, but it sends
>>>mails at runtime. And when there are errors in transaction, objects
>>>have been created and its not commited, but users received mails.
>>>
>>>I think i must use an after commit hook, but transactions not
>>>supported such hooks.
>>
>>Do you not want to send the email and make the SQL/ZODB modification
>>in the *SAME* transaction?
>>
>>Your approach would send the email after the transaction.
>>When the sending failed, your transaction were committed nevertheless.
>>
>>Jens made a transaction aware mailhost. I think, its name
>>is "MailDropHost". It opens a connection to the mail server,
>>lets it check all of the message (and reports any problems)
>>but delays the final "commit" until the transaction is committed.
>>
>>As an additional advantage, this could already be implemented
>>with ancient ZODB versions -- it does not need any extensions.
> 
> 
> I agree with Dieter, the above use cases clearly want to be *in* the
> transaction. Email sending *definitely* wants to be transactional.
> 
> The only use case I can see where a post-commit hook would be useful is
> the "audit logging" thing someone mentionned a few days ago.

I agree.  I think the logging use case is sufficient justification for this.

Jim


More information about the ZODB-Dev mailing list