[ZODB-Dev] Re: afterCommitHook
Florent Guillaume
fg at nuxeo.com
Wed Sep 21 19:25:31 EDT 2005
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.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the ZODB-Dev
mailing list