Re: pg_listening_channels()

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: pg_listening_channels()
Дата
Msg-id e4d8ffe21cee1cfa8a321ca1b99dd3f0@biglumber.com
обсуждение исходный текст
Ответ на Re: pg_listening_channels()  (Igor Neyman <ineyman@perceptron.com>)
Ответы Re: pg_listening_channels()  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


Igor Neyman wrote:
> But, I (and probably many others) use LISTEN/NOTIFY mechanism to notify
> client program connected to postgres database about changes made in the database

Yes, it is commonly used for that.

> Implementation prior to PG 9.0:

> INTERESTED_CLIENT: LISTEN my_alert;
> SOME_OTHER_PROGRAM: INSERTS/UPDATES/DELETES table_client_interested_in;
> ON INSERT/UPDATE/DELETE TRIGGER: check if anyone listens on "my_alert"
>   channel by querying pg_listener table, sends NOTIFY my_alert signal
>   and inserts message into user_message_table;
> INTERESTED_CLIENT: upon receiving NOTIFY signal reads message from
>   user_message_table;

> With PG 9.0 changes I lost ability to check if anyone is interested
> in the NOTIFY signal and payload I'm about to send. Seems like this
> change was not thought through completely.

On the contrary, it was very well discussed and designed. Why do you
even care if the anyone is listening or not? Simply remove the
"check if anyone listens" step and send the NOTIFY.

If you really need to know if anyone is listening, set up a two-way
stream of listen/notify.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 201211292331
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlC4NykACgkQvJuQZxSWSsjNBACfXRI+7IIcFl1COSf+Oe7u8kuU
PhUAn26FHWjQa2yJAP7CmAMWNGLVUQyJ
=xZ4p
-----END PGP SIGNATURE-----




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

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Question about PostgreSQL logging configuration
Следующее
От: Gavan Schneider
Дата:
Сообщение: Re: youtube video on pgsql integrity