Skip site navigation (1) Skip section navigation (2)

Re: Server->Client notification (without polling)?

From: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Server->Client notification (without polling)?
Date: 2006-09-21 13:49:18
Message-ID: 0001HW.C13864FE00BE8C31F0305530@news.individual.de (view raw or flat)
Thread:
Lists: pgsql-novice
>> I read the manual again and now I understand that it's the libpq client 
>> library which requires polling a function to retrieve the notifications 
>> received from the server. Is there no way to tell the library "please 
>> call me when a notification arrives"? 
> 
> No, because it's only a library, it doesn't have its own thread of
> control.

Just to learn something new:

Is this because the library implementor has chosen to do it this way or 
because there is no way to spawn a thread from this library?

I'm just a poor Python scripting dilettant for whom threads and such things 
are deep black voodoo, so please excuse me if this question is utterly 
braindead. :-)

The reason why I am asking for notification without polling is that I would 
like to use a shared PostgreSQL database for data exchange with other 
applications, and the data exchange is likely to happen very intermittently, 
i.e. the data from other applications it will typically arrive in large 
batches, with long pauses (sometimes hours) in between. But I still want to 
get the data as soon as it is available, to not let the end-users wait for 
minutes.
 
> If you are so inclined you can set up your application's main loop to
> watch for input on the database connection's socket (along with whatever
> other event sources it watches) and then call the library to see what it
> was.

Thanks, that's exactly what the example for Psycopg2 does apparently.

Sincerely,

Wolfgang Keller

-- 
My email-address is correct.
Do NOT remove ".nospam" to reply.


In response to

Responses

pgsql-novice by date

Next:From: Wolfgang KellerDate: 2006-09-21 15:10:59
Subject: Re: Server->Client notification (without polling)?
Previous:From: Tony DavisDate: 2006-09-21 12:41:59
Subject: Instal 8.1.4 on XP Home

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group