Обсуждение: Client-Side triggers possible?
Hi, Is there any way to get clients notified about data-changes without polling? What I would need would be a client-side equivalent to triggers, e.g. if one client inserts into a table all other interrested clients should somehow get notified. Thank you in advance, Clemens
Hey,
you should take a look at that :
http://jdbc.postgresql.org/documentation/83/listennotify.html
;)
you should take a look at that :
http://jdbc.postgresql.org/documentation/83/listennotify.html
;)
On Mon, Dec 27, 2010 at 4:01 PM, Clemens Eisserer <linuxhippy@gmail.com> wrote:
Hi,
Is there any way to get clients notified about data-changes without polling?
What I would need would be a client-side equivalent to triggers, e.g.
if one client inserts into a table all other interrested clients
should somehow get notified.
Thank you in advance, Clemens
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
Clemens Eisserer <linuxhippy@gmail.com> wrote: > Is there any way to get clients notified about data-changes > without polling? > > What I would need would be a client-side equivalent to triggers, > e.g. if one client inserts into a table all other interrested > clients should somehow get notified. If you funnel all access through a client-side framework, yes you can do that. This, however, has very little to do with the database which lies behind such a framework -- so a list for a particular database product may not be the best place to ask this question. Be warned that incoming programmers will tend to feel constrained by having to go through your framework rather than using their favorite tools and techniques. Don't try this unless you have managers who are willing to hold the line on this. For that matter, make sure that the benefits outweigh the disadvantages -- there are trade offs here. -Kevin
Micka wrote: > you should take a look at that : > > http://jdbc.postgresql.org/documentation/83/listennotify.html I wonder why you didn't suggest http://jdbc.postgresql.org/documentation/head/listennotify.html Isn't it best to give links to the /current/ docs? (And not to top-post?) -- Lew Ceci n'est pas une pipe.
Hi, > you should take a look at that : > http://jdbc.postgresql.org/documentation/83/listennotify.html Thanks that was exactly what I was looking for :) Unfourtunatly there's still polling required, it seems the jdbc driver has to issue requests in order to get the notifications. > If you funnel all access through a client-side framework, yes you > can do that. This, however, has very little to do with the database > which lies behind such a framework -- so a list for a particular > database product may not be the best place to ask this question. Listen/Notify was what I was looking for, and it is provided by postgresql and its jdbc driver, so I couldn't have asked at a better place. I "only" need this for a university project where we have to solve the same solution one time with a tuple spaced middleware and one time using convetional technologies like RMI or databases. I wouldn't go down that router otherwise ;) Thanks a lot, Clemens
Seriously ?
Maybe because, I didn't know this link .........
But thank you for the advice !
-
Micka
Si ceci est une pipe :)
--
Michael Musset,
Tel: 06 26 06 29 89
Maybe because, I didn't know this link .........
But thank you for the advice !
-
Micka
Si ceci est une pipe :)
On Mon, Dec 27, 2010 at 4:21 PM, Lew <noone@lewscanon.com> wrote:
Micka wrote:I wonder why you didn't suggestyou should take a look at that :
http://jdbc.postgresql.org/documentation/83/listennotify.html
http://jdbc.postgresql.org/documentation/head/listennotify.html
Isn't it best to give links to the /current/ docs?
(And not to top-post?)
--
Lew
Ceci n'est pas une pipe.
--Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
--
Michael Musset,
Tel: 06 26 06 29 89
Micka wrote: > you should take a look at that : http://jdbc.postgresql.org/documentation/head/listennotify.html which tells us > A key limitation of the JDBC driver is that it cannot receive > asynchronous notifications and must poll the backend to check > if any notifications were issued. thus not fulfilling the OP's criterion that there be no polling: Clemens Eisserer wrote: >> Is there any way to get clients notified about data-changes >> without polling? >> >> What I would need would be a client-side equivalent to triggers, >> e.g. [sic] if one client inserts into a table all other interrested >> clients should somehow get notified. -- Lew Ceci n'est pas une pipe.
On 12/28/2010 02:27 AM, Clemens Eisserer wrote: > Hi, > >> you should take a look at that : >> http://jdbc.postgresql.org/documentation/83/listennotify.html > > Thanks that was exactly what I was looking for :) > Unfourtunatly there's still polling required, it seems the jdbc driver > has to issue requests in order to get the notifications. Actually, in newer versions it doesn't have to poll the server. You can test to see if there are notifications ready to receive and process them on a timer loop. You're still polling, but only locally within the JVM; you're not creating any new network activity. This does *NOT* work if you're using an SSL socket, though, so you have to be prepared to fall back to issuing "SELECT 1;" or the like for server-side polling if you can't use client-side-only polling. -- Craig Ringer