From: Kris Jurka <books@ejurka.com>
To: Joel Jacobson <joel@gluefinance.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Java LISTEN/NOTIFY client library work-around
Date: Wed, 30 Nov 2011 19:55:13 -0500 (EST)
Message-ID: <alpine.BSO.2.00.1111301949410.22157@leary.csoft.net> (raw)
In-Reply-To: <CA+9pJHR4SaDbxWGCJKVE0msH6sZKZbNKrzmpUrzjKPn5n9LV2A@mail.gmail.com>
References: <CA+9pJHR4SaDbxWGCJKVE0msH6sZKZbNKrzmpUrzjKPn5n9LV2A@mail.gmail.com>
On Wed, 30 Nov 2011, Joel Jacobson wrote:
> As you know, LISTEN/NOTIFY is broken in the Java client library. You have to
> do a SELECT 1 in a while-loop to receive the notifications.
>
> http://jdbc.postgresql.org/documentation/head/listennotify.html
This documentation is out of date. Currently you can get notifications
without polling the database if you are not using a SSL connection. You
still must poll the driver, using PGConnection.getNotifications, but it
will return new notifications received without an intermediate database
query. This doesn't work over SSL and potentially some other connection
types because it uses InputStream.available that not all
implementations support.
Kris Jurka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, joel@gluefinance.com, pgsql-hackers@postgresql.org
Subject: Re: Java LISTEN/NOTIFY client library work-around
In-Reply-To: <alpine.BSO.2.00.1111301949410.22157@leary.csoft.net>
References: <CA+9pJHR4SaDbxWGCJKVE0msH6sZKZbNKrzmpUrzjKPn5n9LV2A@mail.gmail.com> <alpine.BSO.2.00.1111301949410.22157@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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