Обсуждение: LISTEN / NOTIFY

Поиск
Список
Период
Сортировка

LISTEN / NOTIFY

От
Hannes Dorbath
Дата:
Is there a way I can have notifications to be streamed to the listener,
so I don't need to poll with LISTEN?

LISTEN foo;
LISTEN
NOTIFY foo;
NOTIFY
Asynchronous notification "foo" received from server process with PID 3593.

This does work for the same backend, but not for notifications issued
from another one.

Thanks!

--
Regards,
Hannes Dorbath

Re: LISTEN / NOTIFY

От
Martijn van Oosterhout
Дата:
On Fri, Dec 08, 2006 at 03:38:49PM +0100, Hannes Dorbath wrote:
> Is there a way I can have notifications to be streamed to the listener,
> so I don't need to poll with LISTEN?
>
> LISTEN foo;
> LISTEN
> NOTIFY foo;
> NOTIFY
> Asynchronous notification "foo" received from server process with PID 3593.
>
> This does work for the same backend, but not for notifications issued
> from another one.

AIUI they are, it's just that the client needs to be looking for
incoming data. If you're using psql for example, I don't beleive it
checks for incoming data until you send a command.

How you actually acheive that in your code is a seperate question and
depends on the language you're using.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения