Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
What pattern to make app believe it is not "live" when replaying events
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nathan Evans  
View profile  
 More options Aug 1 2012, 4:21 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 01:21:27 -0700 (PDT)
Local: Wed, Aug 1 2012 4:21 am
Subject: What pattern to make app believe it is not "live" when replaying events

What if you have an event that say sends an e-mail. App shuts down. App
starts up and recreates its state by replaying events. When it gets to the
event that results in an e-mail being sent out, then it will get sent out
for a second time.

I can think of several ways around this but they all seem leaky. In the
sense that it means the app will have to start checking whether it is
"live" or just "replaying/projecting". This would mean that the domain
model is at least slightly aware of its persistence mechanism which doesn't
seem right.

Any ideas? :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Young  
View profile  
 More options Aug 1 2012, 4:29 am
From: Greg Young <gregoryyou...@gmail.com>
Date: Wed, 1 Aug 2012 01:29:32 -0700
Local: Wed, Aug 1 2012 4:29 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events
Projections should never do behaviours.

On Wed, Aug 1, 2012 at 1:21 AM, Nathan Evans <nbev...@gmail.com> wrote:
> What if you have an event that say sends an e-mail. App shuts down. App
> starts up and recreates its state by replaying events. When it gets to the
> event that results in an e-mail being sent out, then it will get sent out
> for a second time.

> I can think of several ways around this but they all seem leaky. In the
> sense that it means the app will have to start checking whether it is "live"
> or just "replaying/projecting". This would mean that the domain model is at
> least slightly aware of its persistence mechanism which doesn't seem right.

> Any ideas? :)

--
Le doute n'est pas une condition agréable, mais la certitude est absurde.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Evans  
View profile  
 More options Aug 1 2012, 5:03 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 02:03:11 -0700 (PDT)
Local: Wed, Aug 1 2012 5:03 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

Yeah I realise that, otherwise you'll get the problem of duplicate e-mails
being sent out, duplicate web service calls, etc etc.

So what is the elegant solution?

Maybe this is more of a DDD question than anything. Is it simply that the
domain model should purely be focused upon managing its own state and
logic, rather than performing behaviours outside of its concern?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Dymitruk  
View profile  
 More options Aug 1 2012, 5:05 am
From: Adam Dymitruk <adymit...@gmail.com>
Date: Wed, 1 Aug 2012 02:05:56 -0700
Local: Wed, Aug 1 2012 5:05 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

Your email service should be resilient to duplicate messages for one. But
you have a bigger issue. You don't do anything except set state when
hydrating.
On Aug 1, 2012 2:03 AM, "Nathan Evans" <nbev...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Young  
View profile  
 More options Aug 1 2012, 5:07 am
From: Greg Young <gregoryyou...@gmail.com>
Date: Wed, 1 Aug 2012 05:07:35 -0400
Local: Wed, Aug 1 2012 5:07 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events
The sending of the email sounds like it would be something that
happens as part of a long running workflow.

--
Le doute n'est pas une condition agréable, mais la certitude est absurde.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Evans  
View profile  
 More options Aug 1 2012, 5:16 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 02:16:54 -0700 (PDT)
Local: Wed, Aug 1 2012 5:16 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

It's purely a theoretical question. This isn't an actual project I'm
working on.

So I guess the answer is either one of the following:

1. Don't ever actually send that e-mail from a domain event. Do it
somewhere else, such as the layer where the domain event was raised in the
first place.

2. Continue sending that e-mail from a domain event. But wrap it in a
condition like: if (projecting == false) { /* send e-mail */ }

Which is it? :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Dymitruk  
View profile  
 More options Aug 1 2012, 5:31 am
From: Adam Dymitruk <adymit...@gmail.com>
Date: Wed, 1 Aug 2012 02:31:19 -0700
Local: Wed, Aug 1 2012 5:31 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

The answer is not one of these.
On Aug 1, 2012 2:16 AM, "Nathan Evans" <nbev...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Evans  
View profile  
 More options Aug 1 2012, 6:05 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 03:05:32 -0700 (PDT)
Local: Wed, Aug 1 2012 6:05 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

Seems I was right though:  
http://lostechies.com/jimmybogard/2008/08/21/services-in-domain-drive...

This was what I was thinking all along really but just wanted to be sure.

Perhaps I was having a blonde moment, sure. But I'm only on day 3 of
recovery from having my brain implosion when I first learnt of Event
Sourcing :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Young  
View profile  
 More options Aug 1 2012, 6:12 am
From: Greg Young <gregoryyou...@gmail.com>
Date: Wed, 1 Aug 2012 06:12:18 -0400
Local: Wed, Aug 1 2012 6:12 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events
Yes n infrastructure service can be used for this...

A question to ask yourself though. If its temporarily failing should
we reject the transaction? There are times when the answer to this
question is a yes but more often than not its a no. If I can't send an
email right now to confirm your order should I not accept your order?

Greg

--
Le doute n'est pas une condition agréable, mais la certitude est absurde.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Evans  
View profile  
 More options Aug 1 2012, 6:27 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 03:27:23 -0700 (PDT)
Local: Wed, Aug 1 2012 6:27 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

That's an implementation detail more than anything, surely? And one that is
normally resolved with a service bus, or at least by queuing up the e-mail
somewhere.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Young  
View profile  
 More options Aug 1 2012, 6:43 am
From: Greg Young <gregoryyou...@gmail.com>
Date: Wed, 1 Aug 2012 06:43:27 -0400
Local: Wed, Aug 1 2012 6:43 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events
I am giving a generalized answer (its not always just email). What
about charging a credit card, writing a transaction to the accounting
system, or telling inventory to move the item to shipping ....

There are loads of cases where you don't want it done as part of the
transaction for the command but prefer to do it from an event (but not
in a projection). This is where long running workflows (process
managers/sagas/whatever you want to call them) come in.

Greg

--
Le doute n'est pas une condition agréable, mais la certitude est absurde.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Evans  
View profile  
 More options Aug 1 2012, 6:52 am
From: Nathan Evans <nbev...@gmail.com>
Date: Wed, 1 Aug 2012 03:52:24 -0700 (PDT)
Local: Wed, Aug 1 2012 6:52 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

How can it be done in an event but not in a projection? That was my
original wonder. It sounds like you are saying that this, in certain cases,
is a totally valid design? So what is the best pattern for having that
event exist, but making it act like a "null event" whenever it is replayed
via projection?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Young  
View profile  
 More options Aug 1 2012, 6:53 am
From: Greg Young <gregoryyou...@gmail.com>
Date: Wed, 1 Aug 2012 03:53:57 -0700
Local: Wed, Aug 1 2012 6:53 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events
I say the pattern names in my response:

"There are loads of cases where you don't want it done as part of the
transaction for the command but prefer to do it from an event (but not
in a projection). This is where long running workflows (process
managers/sagas/whatever you want to call them) come in."

--
Le doute n'est pas une condition agréable, mais la certitude est absurde.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dennis Traub  
View profile  
 More options Aug 1 2012, 7:14 am
From: Dennis Traub <dennis.tr...@gmail.com>
Date: Wed, 1 Aug 2012 13:14:44 +0200
Local: Wed, Aug 1 2012 7:14 am
Subject: Re: [DDD/CQRS] What pattern to make app believe it is not "live" when replaying events

There are different types of event handlers. Not every event handler is a
projection.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »