Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 534612009D9 for ; Thu, 19 May 2016 14:24:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 51E87160A04; Thu, 19 May 2016 12:24:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 99C03160A00 for ; Thu, 19 May 2016 14:24:16 +0200 (CEST) Received: (qmail 38613 invoked by uid 500); 19 May 2016 12:24:15 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 38600 invoked by uid 99); 19 May 2016 12:24:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2016 12:24:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 032D018055E for ; Thu, 19 May 2016 12:24:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UkZ9bgf-FTR3 for ; Thu, 19 May 2016 12:24:13 +0000 (UTC) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 6B03A60E35 for ; Thu, 19 May 2016 12:24:12 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id i142so3873584wmf.0 for ; Thu, 19 May 2016 05:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=1iZ3Nojd6DtPN9+TOBPsGWPVRAggXYgZC933zf+5s8g=; b=jcpSTlvG4anyzmfyUhadiLNIxgckOPWfSvhNZqIlTMr/jgMRGD6wCzIRaIgLDupjaW ihjTVI6skPDv/rGe7eu/R5bFfsnvlOiksOXiupRCwEhZ4RECQnO+C6HoXrBiRZrfASQi gpJzw9jg0tZA92XLfVRunjW+TSdgya41LLN2//yn9WT5fYdsun16oTVJccKGn+gFpotv 9ZYlpQLgPAFQOA5zFDK8Y7ZlHM/hMDVrJXVxrNEXA3cOaOJ+pPc9H/ylQ2wEvZ18kLpD asU4OkiTslAJPUcF9DKw169J+M9l1IWCO9v+U2zS05YNFT6MwKRlfICqmVt2E/XlwWMT nF7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=1iZ3Nojd6DtPN9+TOBPsGWPVRAggXYgZC933zf+5s8g=; b=ewzPja8NJZ/Uv9gsP4jRF8sloG7hd32Tfwf9zYrokIxlbo7uUHTzd1YknrY+3Y0n0i 8hDwzSFpwrd4RnmMTOpatM2WI8mvmnmcWotj5/Ot+E1AJK9PB9qG0VkR+ifRYY9tk+Ns h8CjEs52CmMuvy5bcK7ck9dax+rmofBBnUAN8cAtFor5NTpzJ34KHCQQOxj6NAFmHawN D0X99Df0O9vE/l9Zlm6HeMNZ35BlArxrjZOhtv9v4Psw1rfBaTV8PR+g9qmRLa/Wa712 PfKMr2eyPFhTKJkbAXSya5hO2kjXFmqlEiEKSKlFgMLL6VDakYK9DF5ehqYC/sFGO0mD Xl8A== X-Gm-Message-State: AOPr4FU3uWhyV4F/erHeeFDN+cUjUVjg6GgGi0N2AUpuslhIo68NJbEUIrFZhIfsqVUSHjqrJOwzILvPe/hS8A== MIME-Version: 1.0 X-Received: by 10.28.150.211 with SMTP id y202mr13784456wmd.41.1463660651310; Thu, 19 May 2016 05:24:11 -0700 (PDT) Received: by 10.28.91.7 with HTTP; Thu, 19 May 2016 05:24:11 -0700 (PDT) In-Reply-To: References: Date: Thu, 19 May 2016 14:24:11 +0200 Message-ID: Subject: Re: Post on Trigger From: Harald Kisch To: dev@couchdb.apache.org Content-Type: multipart/alternative; boundary=001a114b2d183177710533310d6c archived-at: Thu, 19 May 2016 12:24:17 -0000 --001a114b2d183177710533310d6c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Reddy, your request seems to be possible for me without any change to the CouchDB code. But you may need to think in another way. For me a trigger is nothing else than a change of a document. On database-change event you can easily trigger any other script in dependence whether a attribute in the changed document exists or not. Also a view index will be updated any time a new document is stored into CouchDB. Why you want to call curl behind the scenes is not transparent to me. For me which urls are called in the background depends on which domain (dev.url, stage.url, www.url) the app was deployed. But it could be that I misunderstand your request. Maybe you can make it more clear to me what you especially want to reach? Cheers, Harry On Thu, May 19, 2016 at 1:49 PM, Reddy B. wrote: > Hi, > > I am fairly new to CouchDb and loving it so far. I think this database is > shockingly underated. I love the "Relax" approach and the design choices > that have been done, and I hope things will continue with the same > philosophy. > > I couldn't find if this has been discussed before but I was thinking that > it would be extremely cool to be able to setup triggers that POST arbitra= ry > json to arbitrary endpoints. I think this would be a killer feature if > there was built-in support for that - and seems to fit well with the HTTP > approach of couch. > > So basically, this would be about allowing us to add an arbitrary number > of triggers to any view. Each trigger would be called only if the view > emitted "something" and the trigger would receive the document passed as = a > parameter to the view (this is to take advantage of the update frequency = of > views) Then in terms of posting, there could be a new built-in javascript > function calling curl behind the scenes which can be called from the > triggers. > > For the same purpose, it would be interesting to introduce configuration > documents at the database level whose properties could be accessed from > these triggers (I'm thinking of situations when one would need to call a > different URL when in testing, staging, production etc...) > > In terms of use case, this would allow us to do things as diverse as > sending email notifications, and maintenance tasks. More generally, this > would eliminate the need for most of the maintenance jobs out there while > making these systems much more efficient by removing the need to run jobs > at arbitrary times even when this is not necessary. Also, since most web > frameworks are asynchronous and process each request in a different > thread, this would be a way to easily parallelize certain operations. > > I just wanted to know if there was any chance to see this come out one da= y > or if this would be a "no-go" for design of philosophical reasons. > > Cheers, > > Reddy > --=20 Dipl.-Inf. Harald R. Kisch Auenstra=C3=9Fe 14 80469 M=C3=BCnchen Germany Tel: +49 (0) 89 41 61 58 57-6 Mobil DE: +49 (0) 176 56 58 58 38 Skype: harald.kisch Mail: haraldkisch@gmail.com --001a114b2d183177710533310d6c--