pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Client-Side triggers possible?
8+ messages / 5 participants
[nested] [flat]

* Client-Side triggers possible?
@ 2010-12-27 15:01  Clemens Eisserer <linuxhippy@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Clemens Eisserer @ 2010-12-27 15:01 UTC (permalink / raw)
  To: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:08  Micka <mickamusset@gmail.com>
  parent: Clemens Eisserer <linuxhippy@gmail.com>
  1 sibling, 2 replies; 8+ messages in thread

From: Micka @ 2010-12-27 15:08 UTC (permalink / raw)
  To: Clemens Eisserer <linuxhippy@gmail.com>; +Cc: pgsql-jdbc

Hey,

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
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:20  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  parent: Clemens Eisserer <linuxhippy@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Kevin Grittner @ 2010-12-27 15:20 UTC (permalink / raw)
  To: Clemens Eisserer <linuxhippy@gmail.com>; 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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:21  Lew <noone@lewscanon.com>
  parent: Micka <mickamusset@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Lew @ 2010-12-27 15:21 UTC (permalink / raw)
  To: pgsql-jdbc

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.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:25  Lew <noone@lewscanon.com>
  parent: Micka <mickamusset@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Lew @ 2010-12-27 15:25 UTC (permalink / raw)
  To: pgsql-jdbc

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.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:27  Clemens Eisserer <linuxhippy@gmail.com>
  parent: Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 8+ messages in thread

From: Clemens Eisserer @ 2010-12-27 15:27 UTC (permalink / raw)
  To: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-27 15:30  Micka <mickamusset@gmail.com>
  parent: Lew <noone@lewscanon.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Micka @ 2010-12-27 15:30 UTC (permalink / raw)
  To: Lew <noone@lewscanon.com>; +Cc: pgsql-jdbc

Seriously ?

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:
>
>> 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.
>
> --
> 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

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Client-Side triggers possible?
@ 2010-12-30 06:32  Craig Ringer <craig@postnewspapers.com.au>
  parent: Clemens Eisserer <linuxhippy@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Craig Ringer @ 2010-12-30 06:32 UTC (permalink / raw)
  To: Clemens Eisserer <linuxhippy@gmail.com>; +Cc: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2010-12-30 06:32 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27 15:01 Client-Side triggers possible? Clemens Eisserer <linuxhippy@gmail.com>
2010-12-27 15:08 ` Micka <mickamusset@gmail.com>
2010-12-27 15:21   ` Lew <noone@lewscanon.com>
2010-12-27 15:30     ` Micka <mickamusset@gmail.com>
2010-12-27 15:25   ` Lew <noone@lewscanon.com>
2010-12-27 15:20 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-12-27 15:27   ` Clemens Eisserer <linuxhippy@gmail.com>
2010-12-30 06:32     ` Craig Ringer <craig@postnewspapers.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox