Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
Date
Msg-id 2637.912614023@sss.pgh.pa.us
Whole thread Raw
In response to Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN  (Peter T Mount <peter@retep.org.uk>)
Responses Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
List pgsql-interfaces
Peter T Mount <peter@retep.org.uk> writes:
> On Wed, 2 Dec 1998, John Bosch wrote:
>> I'm using Postgresql as the database for a Java application I am writing
>> and would like to use the NOTIFY/LISTEN feature of Postgres.

> Ok, you've got me thinking... It shouldn't be too difficult to add NOTIFY
> support. I'll have a look at it during this morning, and I'll get back to
> you.

NOTIFY is no problem --- there's no particular reason not to issue
NOTIFY as a plain SQL command.  It's the LISTEN side of things that
will require some driver support.

Ideally, you'd like to be able to invoke an application-supplied
callback routine asynchronously when a notify message arrives.
I don't know enough about Java to know if it has a well-defined
event loop mechanism, but if it does and your driver can cause events
to be issued, you should be in fat city.

You might care to look at libpgtcl's listen support in 6.4 --- it
automatically issues LISTEN and UNLISTEN commands when the application
registers or deregisters a callback request.

            regards, tom lane

pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: [INTERFACES] Can a PGresult outlive a PGconn
Next
From: Peter T Mount
Date:
Subject: Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN