Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-12-02 Thread Joel Jacobson
2011/12/1 Kris Jurka bo...@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


Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-12-02 Thread Merlin Moncure
On Thu, Dec 1, 2011 at 6:21 AM, Joel Jacobson j...@trustly.com wrote:
 2011/12/1 Kris Jurka bo...@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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Java LISTEN/NOTIFY client library work-around

2011-11-30 Thread Joel Jacobson
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


Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-11-30 Thread Jan Urbański

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-11-30 Thread Andrew Dunstan



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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-11-30 Thread Joel Jacobson
On 30 nov 2011, at 13:27, Jan Urbański wulc...@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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Java LISTEN/NOTIFY client library work-around

2011-11-30 Thread Kris Jurka


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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers