Re: Inter-app communication via DB

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: David <wizzardx(at)gmail(dot)com>
Subject: Re: Inter-app communication via DB
Date: 2008-06-19 13:21:07
Message-ID: 200806191521.09507.dfontaine@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2008-06-19 13:41:10 Re: pg_locks "at-a-glance" view
Previous Message David Fetter 2008-06-19 13:07:09 Re: pg_locks "at-a-glance" view