Re: Inter-app communication via DB - Mailing list pgsql-general

From Dimitri Fontaine
Subject Re: Inter-app communication via DB
Date
Msg-id 200806191521.09507.dfontaine@hi-media.com
Whole thread Raw
In response to Inter-app communication via DB  (David <wizzardx@gmail.com>)
List pgsql-general
Le jeudi 19 juin 2008, David a écrit :
> One pattern I've used is for apps to communicate events to each other
> through the database.
>
> ie:
>
> - App 1 sents a boolean value to True
> - App 2 queries the field every 10s, sets the value to False, and does
> something.
>
> Is this reasonable, or should apps avoid this pattern?

The PGQ package from skytools allows you to produce events into a queue from
the provider side and retrieve them at the consumer(s) side. The consumer(s)
needs not be running while the provider produces them, this will simply cause
lag.

The consuming of events has the options to set any event processing as failed
or retry.

PGQ comes with several APIs, the common one is its SQL one, atop of it reside
both a python one and (recently) a PHP one.

You might want to read those URLs to get more ideas about it, but I'd
definitely consider using PGQ in your case:
 http://skytools.projects.postgresql.org/doc/pgq-sql.html
 http://www.pgcon.org/2008/schedule/events/79.en.html

http://kaiv.wordpress.com/2007/10/19/skytools-database-scripting-framework-pgq/

Regards,
--
dim

Attachment

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: pg_locks "at-a-glance" view
Next
From: "Merlin Moncure"
Date:
Subject: Re: pg_locks "at-a-glance" view