Synchronous LISTEN/NOTIFY?

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Synchronous LISTEN/NOTIFY?
Date: 2001-01-05 03:16:17
Message-ID: 3.0.5.32.20010105111617.0081f8c0@192.228.128.13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Say I have two applications A and B communicating via a postgresql
database. A sends data for B to work on.

How can I get B to _wait_ for a signal from A before proceeding?

Right now it looks like B has to keep polling regularly. So in order for
things to occur in a timely fashion the polling interval has to be
ridiculously short. This means using more CPU than I would like.

Is there a postgresql equivalent of a unix select/accept?

Basically LISTEN doesn't wait. It'll really be nice to have one which does
- lots of cool stuff can be done.

For example, I could have a webapp write trigger another app running as
root- the webapp writes high level stuff to the database, and a run-as-root
app does stuff based on it, this seems to be a more secure. Or I could have
a small app watch some logs for some event, send the data to a database.
Then another small app waits for a trigger and then uses some of that data
to do something else. Or we could even have a database level trigger, so
when a certain criteria is met, the waiting application is triggered.
Basically you now can have apps use the database for instant messaging :).

Is this sort of thing possible with postgresql or even other RDBMs?

Thanks,
Link.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-01-05 03:47:56 Re: Synchronous LISTEN/NOTIFY?
Previous Message Blake Crosby 2001-01-05 03:12:47 Re: Time Zone Query