From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | max <maxbox(at)directbox(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: one more question about LISTEN / NOTIFY |
Date: | 2010-08-08 05:43:53 |
Message-ID: | 4C5E4419.7030009@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On 08/08/10 10:40, max wrote:
> Hello,
>
> I asked about the Listen / Notify commands some weeks ago. I decided to
> give it a trial.
> But I have one more question about it. What happens to notifications if
> the connection from a listener application disconnects unexpected. Does
> PostgreSQL store all notifications that are triggered during this period
> and submit it to the next listener that (re)connect? Or can I lose
> notifications if something unexpected happened with my connection?
You lose notifications during any period you don't have a connection.
Usually you'd be re-reading anything of interest from the database if
you have to reconnect, as any operation on the old connection would've
failed and you'd have to re-try your transaction. You'd be re-populating
any caches, etc.
In my own app, if I lose a connection I re-issue LISTEN s on any keys of
interest, *then* SELECT them to refresh the copies my app has in case
they've changed. If you're using listen/notify as a change notification
system that works great.
If you're trying to use listen/notify as a message queuing mechanism,
you should probably look at dedicated queuing systems. Building your own
queuing system is harder than you'd think, and listen/notify is not
particularly well suited to reliable message queuing.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | - | 2010-08-08 09:24:28 | Java proxies connection to postgres |
Previous Message | max | 2010-08-08 02:40:25 | one more question about LISTEN / NOTIFY |