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:
signature.asc
Description: This is a digitally signed message part.