c# client Best way to check wether a event has been processed

When adding a new event i get an WriteResult as response.

What is the best way to check wether the event has been processed?

Do i have to create a “ProcessedEvent”-Table / collection to check this or is there a good built in feature to do this?

Define "processed" you mean written? When you get a write response it
has been successfully written.

In terms of projections processing ... which projection there could be
117 processing it.

Cheers,

Greg

Good question. i didn’t think about it.

Currenty im concerned about exceptions.

For example. A create user event gets sent but in the moment it is going to be processed the user can’t get created.

would it be a good practice to have something like a “UserCreateCompleted” Collection which may also contain informations about semantic exceptions and would also have entries if the user wasn’t created.

"For example. A create user event gets sent but in the moment it is
going to be processed the user can't get created."

I don't understand why this would be? By definition a User Created
event says the user is created. Are you looking for the concept of a
command which is CreateUser which could be rejected?

command which is CreateUser which could be rejected?

yeah that sounds like a pretty good description of my scenario :slight_smile:

Do you have an implementation example ?

One more addition to descripre my scenario.

If a new user is created i check wether in the primary user projection already a users exists witih the given mail address if not the UserCreated Event is sent.

But due to data races it would be possible that in the mean while a user with the given mail is created, in this case the creation should be rejected.

in CRUD scenarios i would have transactions and database constraints to deal with it.

in the this scenario i want to wait for the creation result and show the user the success or error message.

What is this “primary projection” you speak of? You are making up you’re own concepts. Many people have tried these concepts before and not done well with them.

What you are dealing with in the case of a projection is known as a sliding window problem (you validate off of say 2 second old information and have an opportunity for failure). Checkout the dddcqrs list on this there are many threads.

You could also do this fully consistently with a command. Let’s imagine your user goes to a stream user-name. I send a command create user. As part of that you emit user created and write to the stream with an expected version of (-1 stream does not exist). This would solve your issues as it would never create a duplicated user.

There is also a post I wrote on this that uses the canonical user named must be unique example.

Cheers,

Greg

Thx for your reply.

Yes your right its indeed a sliding time window problem. i’ll check the ddd list with this information.

Can you post the link to the post you mentioned ?

many thanks in advance

boas

I’ve had a similar question some days ago and Greg pointed me to this great article:

http://codebetter.com/gregyoung/2010/08/12/eventual-consistency-and-set-validation/

Regards,

Michael

you store the position of the event in your projection. when you come back online you ask your projection what was the last processed message

Thx for your replies. In my case i found a simpler solution.

I’ve a single stream which processes these events. the stream now saves in memory the streamnames he already has processed, now the api just waits till the channel has processed an event on that stream