Re: Inter-app communication via DB - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: Inter-app communication via DB
Date
Msg-id 20080619102607.GC4167@merkur.hilbert.loc
Whole thread Raw
In response to Re: Inter-app communication via DB  (David <wizzardx@gmail.com>)
List pgsql-general
On Thu, Jun 19, 2008 at 11:46:42AM +0200, David wrote:

> > That will happen anyway, no matter what the message
> > transport is like. Apps will have to read state at startup
> > anyway, no ?
>
> I have a small problem with this. If app1 wants to tell app2 to
> perform an expensive operation (which you don't want app2 to do each
> time it starts up), in the original pattern it could just set a
> boolean variable. Now it needs to both set a boolean variable (in case
> app2 isn't running at the moment) and use NOTIFY (for when it is),
> which seems a bit redundant.

You could add a trigger to the table with the boolean flag.
The trigger sends the NOTIFY all by itself. So when the app
is listening it gets the signal. When it isn't it will read
the flag at startup. All the other app does is set the flag.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

pgsql-general by date:

Previous
From: David
Date:
Subject: Re: Dump and restore problem
Next
From: Sam Mason
Date:
Subject: Re: Understanding fsync