Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C30D8632868 for ; Sun, 18 Jul 2010 13:12:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 15065-01 for ; Sun, 18 Jul 2010 16:12:32 +0000 (UTC) X-Greylist: delayed 00:06:24.640417 by SQLgrey-1.7.6 Received: from smtp-out21.han.skanova.net (smtp-out21.han.skanova.net [195.67.226.208]) by mail.postgresql.org (Postfix) with ESMTP id 19E78632752 for ; Sun, 18 Jul 2010 13:12:32 -0300 (ADT) Received: from W193MTEC (81.235.249.253) by smtp-out21.han.skanova.net (8.5.114) (authenticated as u35603170) id 4BC6D350021319A9 for pgsql-jdbc@postgresql.org; Sun, 18 Jul 2010 18:06:05 +0200 Message-ID: <88EE005181834531B77043041013169F@emea.itt.net> From: "Mikael" To: References: <4C4267FA.2080604@directbox.com> Subject: Re: Questions about Listen/Notify mechanism Date: Sun, 18 Jul 2010 18:06:13 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-15"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.262 tagged_above=-10 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_LOW=-0.7, STOX_REPLY_TYPE=0.439 X-Spam-Level: X-Archive-Number: 201007/47 X-Sequence-Number: 20712 Yes, you do have to poll with a "SELECT 1" to get the notifications, this is very quick and no problem at all, and you can have lots of LISTEN/NOTIFY without adding much load on the network, this works very good so I don't see why you cannot use it. Mikael ----- Original Message ----- From: "max" To: Sent: Sunday, July 18, 2010 4:33 AM Subject: [JDBC] Questions about Listen/Notify mechanism > Hallo, > > I need to write a Java app which deals with as low as possible network > resources. That's why the database should inform my Java app about > changes and I does not have to poll the database every 5 seconds to > recognize them. > I read the Postgresql-JDBC documentation about the Listen/Notify > commands. I do not understand that note > > "A key limitation of the JDBC driver is that it cannot receive > asynchronous notifications and must poll the backend to check if any > notifications were issued." > > Does that mean that the driver will poll the database, e.g. every 5 > seconds? If so, that would not be acceptable for me, because that is > exactly what I want to avoid. The only advantage of using Listen/Notify > in that case would be that I don't need an extra notification table that > my trigger would fill. Am I wrong? Oo > > I hope somebody can help me with that. > > Regard, > > Max > > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc