Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E5E0E6328EA for ; Mon, 19 Jul 2010 09:33:17 -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 55782-05 for ; Mon, 19 Jul 2010 12:33:08 +0000 (UTC) X-Greylist: delayed 01:09:47.090961 by SQLgrey-1.7.6 Received: from claranet-outbound-smtp01.uk.clara.net (claranet-outbound-smtp01.uk.clara.net [195.8.89.34]) by mail.postgresql.org (Postfix) with ESMTP id 232B9632241 for ; Mon, 19 Jul 2010 09:33:10 -0300 (ADT) Received: from [217.158.27.252] (port=39510 helo=srv-vl-ex-02.visitlondon.com) by relay01.mail.eu.clara.net (relay.clara.net [213.253.3.41]:1025) with esmtps (TLS-1.0:RSA_AES_128_CBC_SHA1:16) id 1OaoRL-0006gl-3k (return-path ); Mon, 19 Jul 2010 11:23:19 +0000 thread-index: AcsnNMiF33OIfXkDSqSpTJczGsk7Bw== Received: from tietokone.visitlondon.com (10.112.20.6) by srv-vl-ex-02.visitlondon.com (10.112.10.52) with Microsoft SMTP Server id 8.2.254.0; Mon, 19 Jul 2010 12:23:16 +0100 Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005 Message-ID: <4C4435A4.10609@visitlondon.com> Date: Mon, 19 Jul 2010 12:23:16 +0100 From: Chris Wareham Organization: Visit London User-Agent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.9.2.4) Gecko/20100713 Lightning/1.0b2pre Thunderbird/3.1 MIME-Version: 1.0 To: "max" CC: Subject: Re: Questions about Listen/Notify mechanism References: <4C4267FA.2080604@directbox.com> In-Reply-To: <4C4267FA.2080604@directbox.com> Content-Type: text/plain; format=flowed; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/51 X-Sequence-Number: 20716 On 07/18/10 03:33, max wrote: > 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 > Hi Max, Sounds like you need a message queue in order to implement an event driven architecture, which would eliminate polling entirely. I'm going to be looking into this shortly for a project at work, and I'm hoping to implement the database part of it using Skytools PgQ: http://wiki.postgresql.org/wiki/Skytools http://wiki.postgresql.org/wiki/PGQ_Tutorial I'm planning on pushing messages to a generic queuing package (HornetQ is my preferred choice), with AMQP as the message protocol. From what I've read, this is definitely one of the intended uses of PgQ, although descriptions of how it can be accomplished seems to be limited to a a presentation from PGCon 2010 and a handful blog posts at the moment. Chris =20 Chris Wareham Senior Software Engineer Visit London Ltd 6th floor, 2 More London Riverside London SE1 2RR =20 Tel: +44 (0)20 7234 5848 Fax: +44 (0)20 7234 5753 =20 http://www.visitlondon.com/ =20 =20 BT Visit London Awards 2010 are now open for entry. Go to = http://www.visitlondon.com/awards for more info on categories and how to = enter.=20 =20 Back England=E2=80=99s bid to host the 2018 FIFA World Cup and London as = a Candidate Host City. Visit http://www.england2018bid.com/ or Text = =E2=80=98England=E2=80=99 to 62018 =20 =20 =20 'Visit London Limited' is registered in England under No.761149; Registered Office: Visit London, 2 More London Riverside, London SE1 = 2RR. =20 Visit London is the official visitor organisation for London. Visit = London is partly funded by Partnership, the Mayor's London Development = Agency and London Councils. The information contained in this e-mail is confidential and intended = for the named recipient(s) only. If you have received it in error, = please notify the sender immediately and then delete the message. If you = are not the intended recipient, you must not use, disclose, copy or = distribute this email. The views expressed in this e-mail are those of = the individual and not of Visit London. We reserve the right to read and = monitor any email or attachment entering or leaving our systems without = prior notice. =20 Please don't print this e-mail unless you really need to.