Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 2D6821337B49 for ; Thu, 30 Dec 2010 02:33:01 -0400 (AST) 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 69327-10 for ; Thu, 30 Dec 2010 06:32:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id ED1EC1336FA7 for ; Thu, 30 Dec 2010 02:32:53 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 374F837; Thu, 30 Dec 2010 01:32:52 -0500 (EST) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id e+irnirOlCiX; Thu, 30 Dec 2010 01:32:51 -0500 (EST) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 4DAE519; Thu, 30 Dec 2010 01:32:51 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 105C1AE873; Thu, 30 Dec 2010 14:32:50 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6bh+85gm7jZt; Thu, 30 Dec 2010 14:32:44 +0800 (WST) Received: from [10.1.1.2] (124-168-182-57.dyn.iinet.net.au [124.168.182.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 7E773AE681; Thu, 30 Dec 2010 14:32:43 +0800 (WST) Message-ID: <4D1C2780.4030603@postnewspapers.com.au> Date: Thu, 30 Dec 2010 17:32:32 +1100 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: Clemens Eisserer CC: pgsql-jdbc@postgresql.org Subject: Re: Client-Side triggers possible? References: <4D185A5A0200002500038BB1@gw.wicourts.gov> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/89 X-Sequence-Number: 21327 On 12/28/2010 02:27 AM, Clemens Eisserer wrote: > Hi, > >> you should take a look at that : >> http://jdbc.postgresql.org/documentation/83/listennotify.html > > Thanks that was exactly what I was looking for :) > Unfourtunatly there's still polling required, it seems the jdbc driver > has to issue requests in order to get the notifications. Actually, in newer versions it doesn't have to poll the server. You can test to see if there are notifications ready to receive and process them on a timer loop. You're still polling, but only locally within the JVM; you're not creating any new network activity. This does *NOT* work if you're using an SSL socket, though, so you have to be prepared to fall back to issuing "SELECT 1;" or the like for server-side polling if you can't use client-side-only polling. -- Craig Ringer