Re: How about synchronous notifications?

Поиск
Список
Период
Сортировка
От Lincoln Yeoh
Тема Re: How about synchronous notifications?
Дата
Msg-id 20100922135420.C257F133798F@mail.postgresql.org
обсуждение исходный текст
Ответ на Re: pg_notify but no pg_listen?  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-general
At 07:55 PM 9/22/2010, Vick Khera wrote:

>Here's how you do it: first, make sure you are not within a
>transaction or other Pg activity.  Get the socket's file handle from
>the Pg connection handle.  When you're ready to wait for a notify
>event, just do a select() system call on that file handle waiting
>until there is data to read on that socket.
>
>When you return from the select, just check for the notifications and
>you're ready to go.  If you did not find a notification, return to the
>select() call.  Of course, this assumes you've issued the necessary
>LISTEN command.
>
>This has worked for me (and is tested well) up thru Pg 8.3. I cannot
>imagine it would stop working as the wire line protocol doesn't really
>change.

How'd one get the socket file handle if using JDBC/ODBC? It seems
possible if using perl DBD-Pg, but I haven't tested that to see if
you can really get out of a transaction.

Given these issues I guess it would be easier to use a separate
messaging server (despite that still not being that easy :) ). This
would have the characteristic of not being DB specific, so apps
wouldn't be locked in to postgresql. Whether this is a benefit or not
depends on your POV ;).

Regards,
Link.


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

Предыдущее
От: Nagy Zoltan
Дата:
Сообщение: Re: versioned pl/pgsql functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: What's wrong with this query?