Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 52C82B5DD08 for ; Thu, 18 Aug 2011 07:40:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 83077-03-6 for ; Thu, 18 Aug 2011 10:40:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from acidenitrix.villemain.org (acidenitrix.villemain.org [91.121.90.165]) by mail.postgresql.org (Postfix) with ESMTP id 9F509B5DCEE for ; Thu, 18 Aug 2011 07:40:09 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=dim) by acidenitrix.villemain.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Qu018-00029q-Ci; Thu, 18 Aug 2011 12:40:06 +0200 Received: by dim (Postfix, from userid 1000) id C7A0641DC6; Thu, 18 Aug 2011 12:40:05 +0200 (CEST) From: Dimitri Fontaine To: Chris Travers Cc: Darren Duncan , pgsql-general@postgresql.org Subject: Re: Using Postgresql as application server Organization: 2ndQuadrant References: <4E498536.9080109@darrenduncan.net> User-Mail-Address: dimitri@2ndQuadrant.fr Date: Thu, 18 Aug 2011 12:40:05 +0200 In-Reply-To: (Chris Travers's message of "Mon, 15 Aug 2011 13:50:17 -0700") Message-ID: <87mxf780l6.fsf@hi-media-techno.com> User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/590 X-Sequence-Number: 178872 Chris Travers writes: > I want an email to go out to the ordering manager when the quantity I > have of an item drops below the re-order point. I also want this > email NOT to go out if the transaction rolls back. (Wait, the order > of 50000 widgets I just processed rolled back because it isn't to a > valid customer! We normally only sell 50000 per year anyway. No need > for the email.) Just use PGQ and be done with it. You have transactional and asynchronous behavior. Typically, a trigger would produce events in the queue, and a separate daemon will consume the queue and send emails. Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support