Re: NOTIFY in asynchronous mode - Mailing list psycopg

From Daniele Varrazzo
Subject Re: NOTIFY in asynchronous mode
Date
Msg-id CA+mi_8ZOnbNEBxhdBVeY8riB_DP+nFRGfG4vZMmBW3MzsiTgGg@mail.gmail.com
Whole thread Raw
In response to Re: NOTIFY in asynchronous mode  (Jan Urbański <wulczer@wulczer.org>)
Responses Re: NOTIFY in asynchronous mode
List psycopg
On Nov 5, 2011 12:21 AM, "Jan Urbański" <wulczer@wulczer.org> wrote:
>
> On 05/11/11 01:15, Daniele Varrazzo wrote:

> > Is it possible to use a naked psycopg connection instead of tx? I
> > mean, not for the regular query-return cycle, but just for sitting
> > idle in the reactor and get a callback called upon notify.
>
> Not in an easy way, I'm afraid. Stuff put in the reactor as readers need
> to implement the IReadDescriptor interface[0] which means you'd have to
> wrap the connection object with something that proxies fileno() to the
> connection and looks for notifies when doRead() is called on it.

Doh, sorry if I made it too easy. It would be great if notifies could
be used easily from Twisted: they seem made for each other like bread
and nutella. Please keep us informed if you manage to add the support
to the library.

Comparatively, receiving notifies in greenlet environments is
straightforward:
<http://initd.org/psycopg/articles/2010/12/01/postgresql-notifications-psycopg2-eventlet/>.

-- Daniele

psycopg by date:

Previous
From: Tobias Oberstein
Date:
Subject: Re: NOTIFY in asynchronous mode
Next
From: Jan Urbański
Date:
Subject: Re: NOTIFY in asynchronous mode