Return-Path: X-Original-To: apmail-zest-dev-archive@minotaur.apache.org Delivered-To: apmail-zest-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 C776D18601 for ; Thu, 30 Jul 2015 01:37:03 +0000 (UTC) Received: (qmail 46331 invoked by uid 500); 30 Jul 2015 01:37:03 -0000 Delivered-To: apmail-zest-dev-archive@zest.apache.org Received: (qmail 46293 invoked by uid 500); 30 Jul 2015 01:37:03 -0000 Mailing-List: contact dev-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list dev@zest.apache.org Received: (qmail 46281 invoked by uid 99); 30 Jul 2015 01:37:03 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2015 01:37:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 0808BC123B for ; Thu, 30 Jul 2015 01:37:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.98 X-Spam-Level: ** X-Spam-Status: No, score=2.98 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 5wJtuHIBnt9f for ; Thu, 30 Jul 2015 01:37:01 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 6E678203A3 for ; Thu, 30 Jul 2015 01:37:00 +0000 (UTC) Received: by laah7 with SMTP id h7so16432124laa.0 for ; Wed, 29 Jul 2015 18:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=TnXc5SWNIWltPU0hfWTY919HP8jl9NA1zm/Z3ULG07Q=; b=VYZnMsE1aRM+NU2W+9Sf8yZdBe/unDCAuKRtuPrQRecVjQiI7qv2MFHSe4HvJaEWUt GQp0WfcknH18uipbJzvLS4oWg0a2O5w4PSZ9NYQqr6f7YobHs8CI9I4gMsn+MhXNjjh3 E9TWzGobPh0h1iPyF3freE18bpe7X5j9wfPV4pw3LkIVM4k2CatolPASCLEWUGwGKuux 1KIw/d5qIYIlzfzavqohvYPfc6AN7ZFbAyLzidi1N0U0cR4B86BJFG/YCpbV8uF5DT1M mk44AqqwBNOEzncOShAn3Hn3YRXpRCV0JtBzmxVW6Bruk6fNJNoYKIi1FcaN6IRS39nI 0uIA== X-Received: by 10.152.10.97 with SMTP id h1mr42024211lab.45.1438220174929; Wed, 29 Jul 2015 18:36:14 -0700 (PDT) MIME-Version: 1.0 Sender: hedhman@gmail.com Received: by 10.25.148.84 with HTTP; Wed, 29 Jul 2015 18:35:55 -0700 (PDT) In-Reply-To: <55B94989.5040103@gmail.com> References: <55B3F8D8.7000305@gmail.com> <55B94989.5040103@gmail.com> From: Niclas Hedhman Date: Thu, 30 Jul 2015 09:35:55 +0800 X-Google-Sender-Auth: FzCaY0Dk8tpSsIZXoNljMaPUv68 Message-ID: Subject: Re: [Proposal] EventSourcing support To: dev Content-Type: multipart/alternative; boundary=001a1132f682a2b71e051c0dba21 --001a1132f682a2b71e051c0dba21 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Right now, I only want to rehash the last point, about "replay of past events". I think you misunderstood my point. SO let's look at an example; Let's say that the model is a bank Account, which only has "AmountDeposited" and "AmoundWithdrawn" events in it. And these events are generated as notifications to other Aggregates to react on. Later on, it is detected that another system was expecting "AccountOverdrawn" and "AccountRecovered" events when the balance goes below zero (and comes back above zero), but the Account has the bug that it is never emitting such event. I.e. this is a "derived event" and in all the event-driven systems that I have written, it is very common, more the norm than the exception. So, if the events are replayed (properly replayed, at system level and not only aggregate level for state restoration), then new events would be generated. IIUIC, the current EventSourcing library has a problem with "derived events" too. Since the "record/replay" mechanism is intercepting/injecting the Event methods, any call from one Event method to another Event method, would result in execution of the second event method twice, first from being a derived event, and secondly from the previously recorded event, unless de-duplication is happening, AND that Event equals() never changes over time. It feels to me that there is something not quite right, but I can't put my finger on it yet. Niclas On Thu, Jul 30, 2015 at 5:45 AM, Kent S=C3=B8lvsten wrote: >> >> Let's ponder about "replay of past events"... >> >> EventSourcing prides itself that one can change the algorithm, replay th= e >> events and hence retro-actively fix bugs in the past. BUT, what happens if >> the new algorithm emits new events, but in past time? Should those be >> injected into history? Or vice versa, what if the bug was that too many >> events were emitted, should those now be removed? Or is it that ONLY the >> State Resolver is allowed to be modified, and that the replay is >> effectively "never" happening as a global thing, but just internally in the >> Aggregate Root whenever its state is loaded?? >> >> I bet that this has been discussed endlessly on various forums, and I >> should probably go digging. > I remember Greg Young discussing that past events should never be > modified - but new compensating events might be added to the history (If > money are transfered from a bank account by a mistake, the transfer is > not deleted - instead a compensating transfer is added). > > I think we should simply disallow nesting events - so replaying an event > can never emit other events. And otherwise the problem to the > applications - and wait and see if anything more should be done to ease > their task. -- Niclas Hedhman, Software Developer http://zest.apache.org - New Energy for Java --001a1132f682a2b71e051c0dba21--