Re: PL/Perl 64-bit and sending emails

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Steve Atkins <steve(at)blighty(dot)com>
Cc: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Subject: Re: PL/Perl 64-bit and sending emails
Date: 2009-09-04 14:26:44
Message-ID: m2r5um23bv.fsf@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Steve Atkins <steve(at)blighty(dot)com> writes:

> On Sep 3, 2009, at 11:30 AM, Mark Lubratt wrote:
>> Or, does someone know of another way to get the
>> backend to send an email?
>
> Have a queue table in the database you put your emails into and an external
> process that polls the table, sends the email and deletes the entry from
> the queue. Apart from avoiding the ickiness of doing high latency work from
> a database function this also makes sending email transaction safe - if the
> transaction rolls back after "sending" the email, the email doesn't get
> sent.
>
> Using listen/notify based on a trigger on the table makes it a little more
> responsive.
>
> This comes up fairly often. It's probably worth doing a tidy perl daemon to
> handle it and stashing it up on pgfoundry.

Or have a look at PGQ which is made to handle this kind of queue
processing:
http://wiki.postgresql.org/wiki/Skytools
http://wiki.postgresql.org/wiki/PGQ_Tutorial
http://kaiv.wordpress.com/2007/10/19/skytools-database-scripting-framework-pgq/

Regards,
--
dim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-09-04 14:27:41 Re: Got could not truncate directory "pg_multixact/offsets": apparent wraparound
Previous Message acordner 2009-09-04 14:17:40 Re: Add Large Object support to database programmatically