pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedUsing Postgres's NOTIFY/LISTEN
5+ messages / 4 participants
[nested] [flat]
* Using Postgres's NOTIFY/LISTEN
@ 1998-12-02 05:11 John Bosch <jbosch@john.cdscc.nasa.gov>
0 siblings, 1 reply; 5+ messages in thread
From: John Bosch @ 1998-12-02 05:11 UTC (permalink / raw)
To: pgsql-interfaces
Hi all,
I'm new here and was wondering if anyone could answer the following
questions.
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. Can anyone
tell if and how I can use these functions through the Postgres JDBC
driver.
Otherwise I'll have to think of another way of doing what I want to do
:(
--
regards,
John Bosch
Systems Engineer
Canberra Deep Space Communications Complex
jbosch@john.cdscc.nasa.gov
I doubt, therefore I might be.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
@ 1998-12-02 06:46 Peter T Mount <peter@retep.org.uk>
parent: John Bosch <jbosch@john.cdscc.nasa.gov>
0 siblings, 1 reply; 5+ messages in thread
From: Peter T Mount @ 1998-12-02 06:46 UTC (permalink / raw)
To: John Bosch <jbosch@john.cdscc.nasa.gov>; +Cc: pgsql-interfaces
On Wed, 2 Dec 1998, John Bosch wrote:
> Hi all,
>
> I'm new here and was wondering if anyone could answer the following
> questions.
>
> 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. Can anyone
> tell if and how I can use these functions through the Postgres JDBC
> driver.
It's one of those things I didn't include in the driver :-(
> Otherwise I'll have to think of another way of doing what I want to do
> :(
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.
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
@ 1998-12-02 15:53 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter T Mount <peter@retep.org.uk>
0 siblings, 2 replies; 5+ messages in thread
From: Tom Lane @ 1998-12-02 15:53 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; +Cc: 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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
@ 1998-12-02 18:49 Peter T Mount <peter@retep.org.uk>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Peter T Mount @ 1998-12-02 18:49 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
On Wed, 2 Dec 1998, Tom Lane wrote:
> 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.
The 1.1 AWT uses a listener model for it's events. I was thinking of
creating an Interface that defines a method that is called when a notify
occurs. Then, the client can create a class that implements this
Interface, and simply calls an addListener() method in the driver. Then,
any notify's received will cause the listener to be called.
The client can then stop this with the removeListener() method.
> 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.
I was thinking along those lines for the addListener() and
removeListener() methods.
So far, today has been hell at work (as usual, NT decides to commit
suicide), so I didn't get round to looking at this. I'll do that shortly.
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] Using Postgres's NOTIFY/LISTEN
@ 1998-12-06 13:35 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Herouth Maoz @ 1998-12-06 13:35 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; +Cc: pgsql-interfaces
At 20:49 +0200 on 2/12/98, Peter T Mount wrote:
>
> The 1.1 AWT uses a listener model for it's events. I was thinking of
> creating an Interface that defines a method that is called when a notify
> occurs. Then, the client can create a class that implements this
> Interface, and simply calls an addListener() method in the driver. Then,
> any notify's received will cause the listener to be called.
Hmm, wouldn't using the AWT cause the driver to attempt to initialize the X
windows or something? I know some servlet implementations (Netscape's, for
one) do not support any AWT calls, assuming that when you work through the
web, you don't have an X server, which is true.
Can't it be done with threads, Object.notify() etc.?
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~1998-12-06 13:35 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-12-02 05:11 Using Postgres's NOTIFY/LISTEN John Bosch <jbosch@john.cdscc.nasa.gov>
1998-12-02 06:46 ` Peter T Mount <peter@retep.org.uk>
1998-12-02 15:53 ` Tom Lane <tgl@sss.pgh.pa.us>
1998-12-02 18:49 ` Peter T Mount <peter@retep.org.uk>
1998-12-06 13:35 ` Herouth Maoz <herouth@oumail.openu.ac.il>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox