pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedJava LISTEN/NOTIFY client library work-around
7+ messages / 6 participants
[nested] [flat]
* Java LISTEN/NOTIFY client library work-around
@ 2011-11-30 12:07 Joel Jacobson <joel@gluefinance.com>
0 siblings, 2 replies; 7+ messages in thread
From: Joel Jacobson @ 2011-11-30 12:07 UTC (permalink / raw)
To: pgsql-hackers@postgresql.org
Hi,
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
Is there some other library with a proper implementation where you don't
have to spam the database with queries to get the notifications?
If not, my company is willing to sponsor development of a patch fixing this
problem.
--
Best regards,
Joel Jacobson
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-11-30 12:27 Jan Urbański <wulczer@wulczer.org>
parent: Joel Jacobson <joel@gluefinance.com>
1 sibling, 2 replies; 7+ messages in thread
From: Jan Urbański @ 2011-11-30 12:27 UTC (permalink / raw)
To: Joel Jacobson <joel@gluefinance.com>; +Cc: pgsql-hackers@postgresql.org
On 30/11/11 13:07, Joel Jacobson wrote:
> Hi,
>
> 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
>
> Is there some other library with a proper implementation where you don't
> have to spam the database with queries to get the notifications?
You mean a Java library? If Java is not a requirement, the psycopg2
Python library supports notifies well.
Cheers,
Jan
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-11-30 13:58 Andrew Dunstan <andrew@dunslane.net>
parent: Jan Urbański <wulczer@wulczer.org>
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Dunstan @ 2011-11-30 13:58 UTC (permalink / raw)
To: Jan Urbański <wulczer@wulczer.org>; +Cc: Joel Jacobson <joel@gluefinance.com>; pgsql-hackers@postgresql.org
On 11/30/2011 07:27 AM, Jan Urbański wrote:
> On 30/11/11 13:07, Joel Jacobson wrote:
>> Hi,
>>
>> 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
>>
>> Is there some other library with a proper implementation where you don't
>> have to spam the database with queries to get the notifications?
>
> You mean a Java library? If Java is not a requirement, the psycopg2
> Python library supports notifies well.
>
>
... and probably most libraries that (unlike JDBC) are libpq-based, like
the perl DBD::Pg.
cheers
andrew
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-11-30 20:13 Joel Jacobson <joel@gluefinance.com>
parent: Jan Urbański <wulczer@wulczer.org>
1 sibling, 0 replies; 7+ messages in thread
From: Joel Jacobson @ 2011-11-30 20:13 UTC (permalink / raw)
To: Jan Urbański <wulczer@wulczer.org>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
On 30 nov 2011, at 13:27, Jan Urbański <wulczer@wulczer.org> wrote:
> On 30/11/11 13:07, Joel Jacobson wrote:
>> Hi,
>>
>> 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
>>
>> Is there some other library with a proper implementation where you don't
>> have to spam the database with queries to get the notifications?
>
> You mean a Java library? If Java is not a requirement, the psycopg2 Python library supports notifies
I need a Java-library for this
>
> Cheers,
> Jan
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-12-01 00:55 Kris Jurka <books@ejurka.com>
parent: Joel Jacobson <joel@gluefinance.com>
1 sibling, 1 reply; 7+ messages in thread
From: Kris Jurka @ 2011-12-01 00:55 UTC (permalink / raw)
To: Joel Jacobson <joel@gluefinance.com>; +Cc: pgsql-hackers@postgresql.org; pgsql-jdbc
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-12-01 12:21 Joel Jacobson <joel@trustly.com>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 7+ messages in thread
From: Joel Jacobson @ 2011-12-01 12:21 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-hackers@postgresql.org; pgsql-jdbc
2011/12/1 Kris Jurka <books@ejurka.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.
>
I know it works without SSL, but we need SSL for this.
If it would be possible to fix it, my company is as I said willing to pay
for the cost of such a patch.
>
> Kris Jurka
>
--
Joel Jacobson
Trustly
+46703603801
https://trustly.com
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Java LISTEN/NOTIFY client library work-around
@ 2011-12-02 16:16 Merlin Moncure <mmoncure@gmail.com>
parent: Joel Jacobson <joel@trustly.com>
0 siblings, 0 replies; 7+ messages in thread
From: Merlin Moncure @ 2011-12-02 16:16 UTC (permalink / raw)
To: Joel Jacobson <joel@trustly.com>; +Cc: Kris Jurka <books@ejurka.com>; pgsql-hackers@postgresql.org; pgsql-jdbc
On Thu, Dec 1, 2011 at 6:21 AM, Joel Jacobson <joel@trustly.com> wrote:
> 2011/12/1 Kris Jurka <books@ejurka.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.
>
>
> I know it works without SSL, but we need SSL for this.
>
> If it would be possible to fix it, my company is as I said willing to pay
> for the cost of such a patch.
I certainly don't want to discourage you from cleaning up the jdbc ssl
situation, but one workaround might be to use stunnel.
merlin
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2011-12-02 16:16 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30 12:07 Java LISTEN/NOTIFY client library work-around Joel Jacobson <joel@gluefinance.com>
2011-11-30 12:27 ` Jan Urbański <wulczer@wulczer.org>
2011-11-30 13:58 ` Andrew Dunstan <andrew@dunslane.net>
2011-11-30 20:13 ` Joel Jacobson <joel@gluefinance.com>
2011-12-01 00:55 ` Kris Jurka <books@ejurka.com>
2011-12-01 12:21 ` Joel Jacobson <joel@trustly.com>
2011-12-02 16:16 ` Merlin Moncure <mmoncure@gmail.com>
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