Re: Questions about Listen/Notify mechanism

From: Chris Wareham <cwareham(at)visitlondon(dot)com>
To: "max" <maxbox(at)directbox(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Questions about Listen/Notify mechanism
Date: 2010-07-19 11:23:16
Message-ID: 4C4435A4.10609@visitlondon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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


Chris Wareham
Senior Software Engineer
Visit London Ltd
6th floor,
2 More London Riverside
London SE1 2RR

Tel: +44 (0)20 7234 5848
Fax: +44 (0)20 7234 5753

http://www.visitlondon.com/


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.

Back England’s bid to host the 2018 FIFA World Cup and London as a Candidate Host City. Visit http://www.england2018bid.com/ or Text ‘England’ to 62018



'Visit London Limited' is registered in England under No.761149;
Registered Office: Visit London, 2 More London Riverside, London SE1 2RR.

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.

Please don't print this e-mail unless you really need to.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Matthew Wakeling 2010-07-19 11:35:16 Re: Trouble with COPY IN
Previous Message Craig Ringer 2010-07-19 02:09:00 Re: Questions about Listen/Notify mechanism