Re: mail alert

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: mail alert
Date: 2009-08-13 22:24:07
Message-ID: m3bpmjfj3s.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:

>> > It's on Windows

>> I'd go with notify and a listener written in C using c-client to send
>> emails, but only because I've used those before.

> I wouldn't write it in C but rather Perl or Python, but whatever suits
> your fancy should work (Visual Basic anyone?). The advantages to using
> a listener program instead of doing it in a trigger or something like
> that are:

> - transaction semantics are kept; you don't send an email only to find
> out your transaction has been rolled back for whatever reason, and then
> send a second email when the transaction is replayed

> - you don't block the database system just because your mail server is
> down

> - the email can be sent on whatever schedule fits the listener program

> - the listener client can run elsewhere, not only in the database server

> - any further external processing can take place at that time, without
> bothering the database server

> - other stuff I don't recall ATM

The main disadvantage in using a listener is that it is your
responsibility to make sure that the listener is listening
24/7 - from before the database accepts other connections,
through network failures, bugs, etc. - otherwise notifica-
tions will be lost. Therefore I find it much more reliable
(and easier to program) to copy the relevant data to a table
"mailqueue" (or whatever) and then process that queue every
other minute.

Tim

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-13 22:36:00 Re: mail alert
Previous Message Alvaro Herrera 2009-08-13 21:54:20 Re: mail alert