From: Chris Wareham <cwareham@visitlondon.com>
To: max <maxbox@directbox.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Questions about Listen/Notify mechanism
Date: Mon, 19 Jul 2010 12:23:16 +0100
Message-ID: <4C4435A4.10609@visitlondon.com> (raw)
In-Reply-To: <4C4267FA.2080604@directbox.com>
References: <4C4267FA.2080604@directbox.com>
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/Skytoolshttp://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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: cwareham@visitlondon.com, maxbox@directbox.com
Subject: Re: Questions about Listen/Notify mechanism
In-Reply-To: <4C4435A4.10609@visitlondon.com>
References: <4C4267FA.2080604@directbox.com> <4C4435A4.10609@visitlondon.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox