Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C8914100ED for ; Thu, 7 Nov 2013 18:45:24 +0000 (UTC) Received: (qmail 51873 invoked by uid 500); 7 Nov 2013 18:45:24 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 51732 invoked by uid 500); 7 Nov 2013 18:45:24 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 51724 invoked by uid 99); 7 Nov 2013 18:45:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Nov 2013 18:45:23 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jukka.zitting@gmail.com designates 209.85.219.43 as permitted sender) Received: from [209.85.219.43] (HELO mail-oa0-f43.google.com) (209.85.219.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Nov 2013 18:45:18 +0000 Received: by mail-oa0-f43.google.com with SMTP id m1so1434301oag.30 for ; Thu, 07 Nov 2013 10:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=6BtUI//oaAawL4cZ/i6ikXCACgcmBK5FFnblm62cDi4=; b=Z+iWKA2ZmcPDJtL7fyJUFL55Ao4ZJJUEMHi12a0ctOQfYwzcVKd21lH2ea99yOsJ5t IG+dVRFJagBa3DPlWcHk/zcQxXCyi1XUUrUWz/5abg82LhAlQihswS4cvPuuH+yA7SQ4 17OhSuhw7i8At2Bn/Y8DGRthDfSe5gyQiuvAbKN7C1rg4j48ZQ3E1iMJw32xUQwnRGXg yKkAIDF3GWqr7Z9x400zzZYT8gH7g7M9HjY5PyHJLFfNtmAMMu/rCxsfI37gUYACcGG5 gGt9iPHXuSFQNJRM4z8EISzqUwx1K2dK6pdXjyWbZTVz3vq3gtR9MRwYfA2hfNOojN2D oOfA== X-Received: by 10.60.40.70 with SMTP id v6mr1030330oek.69.1383849897979; Thu, 07 Nov 2013 10:44:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.115.67 with HTTP; Thu, 7 Nov 2013 10:44:37 -0800 (PST) In-Reply-To: References: <33997BDF-F06A-4120-BE72-E41481B5C7EF@adobe.com> From: Jukka Zitting Date: Thu, 7 Nov 2013 13:44:37 -0500 Message-ID: Subject: Re: Observation To: Oak devs Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi, On Thu, Nov 7, 2013 at 1:12 PM, Tobias Bocanegra wrote: > On Thu, Nov 7, 2013 at 5:46 AM, Jukka Zitting wrote: >> On Wed, Nov 6, 2013 at 8:49 PM, Alexander Klimetschek >> wrote: >>> 1) listeners should not get external events by default >> >> I'd rather not make such a default. A component designed to process >> local changes should in most cases be implemented as a commit hook, >> not an observation listener. > > I disagree. the commit hook is executed before the commit - which > still can fail. Also, the commit hook is highly inconvenient to use. > what you really want are nicely aggregated observation events :-) Right, but the local-only observation pattern is structurally flawed, as it can't guarantee that the events actually do get processed (for example if the server dies during event delivery). Commit hooks don't have that problem. The case where a commit hook would not be applicable is when the relevant functionality triggers some external changes, for example sending an email notification. In such cases the local-only observation pattern is used as a basic cluster synchronization mechanism for guaranteeing that the event is only processed once across the cluster. There are other, more reliable ways of doing that. For example the checkpoint mechanism used by the asynchronous indexer can guarantee that each change is processed once and only once across a cluster, even if there are multiple concurrent listeners or if all of them become unavailable for a while. AFAICT there's no use case for which the local only -listener pattern would be the best solution, so while we do need it for backwards compatibility, it IMHO should not be the default for any new functionality. BR, Jukka Zitting