Re: NOTIFY

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: NOTIFY
Дата
Msg-id CAKFQuwbLxck22uPwkUtRfq-O_SERm6hmOJ7=kcpNXeH5Gzfuxg@mail.gmail.com
обсуждение исходный текст
Ответ на NOTIFY  ("Greg Rychlewski (LCL)" <Greg.Rychlewski@loblaw.ca>)
Ответы Re: [EXT] Re: NOTIFY  ("Greg Rychlewski (LCL)" <Greg.Rychlewski@loblaw.ca>)
Список pgsql-novice
On Mon, Sep 28, 2020 at 3:35 PM Greg Rychlewski (LCL) <Greg.Rychlewski@loblaw.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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Greg Rychlewski (LCL)"
Дата:
Сообщение: NOTIFY
Следующее
От: "Greg Rychlewski (LCL)"
Дата:
Сообщение: Re: [EXT] Re: NOTIFY