Re: NOTIFY

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Greg Rychlewski (LCL)" <Greg(dot)Rychlewski(at)loblaw(dot)ca>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: NOTIFY
Date: 2020-09-29 00:06:45
Message-ID: CAKFQuwbLxck22uPwkUtRfq-O_SERm6hmOJ7=kcpNXeH5Gzfuxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Sep 28, 2020 at 3:35 PM Greg Rychlewski (LCL) <
Greg(dot)Rychlewski(at)loblaw(dot)ca> wrote:

> Hi,
>
>
>
> I’m considering using NOTIFY to let my application react to changes in a
> table. If I only send the channel name without a payload, could I run into
> this issue:
>
>
>
> 1. The table is updated and a notification is sent to my app
> 2. My app reads the table, but hasn’t sent acknowledgement of the
> notification yet
> 3. The table is updated again, but the notification gets dropped
> because it’s the same as (1), which hasn’t been acknowledged by the app
>
>
>
> If this happened then there would be new data in my table but my app
> wouldn’t read it until the next time there was an update.
>

I don't understand where you are getting point 2 from - the pub/sub model
doesn't require subscribers to acknowledge the notifications.

For point 3 you seem to have mis-read the NOTIFY documentation, which
states:

"If the same channel name is signaled multiple times with identical payload
strings within the same transaction, only one instance of the notification
event is delivered to listeners."

The part about "within the same transaction" solves your concurrency
concern, and doesn't say anything about acknowledgements.

David J.

In response to

  • NOTIFY at 2020-09-28 22:34:51 from Greg Rychlewski (LCL)

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Greg Rychlewski (LCL) 2020-09-29 00:33:46 Re: [EXT] Re: NOTIFY
Previous Message Greg Rychlewski (LCL) 2020-09-28 22:34:51 NOTIFY