Event processing order
See original GitHub issueI have a doubt about the order in which the events will be handled/reduced.
Let’s say I send a command with CreateUser
. That command will then register an event UserCreated
that will be reduced by a User
entity.
In my application, I want to be able to access that User
that has just been created (via Booster.fetchEntitySnapshot), so I create a new event AfterUserCreation
that will have User
as a param. This new event will be fired by the UserCreated
event handler:
@EventHandler(UserCreated)
export class HandleUserCreated {
public static async handle(
event: UserCreated,
register: Register
): Promise<void> {
//Here is where I'd perform Booster.fetchEntitySnapshot to get User
register.events(new AfterUserCreation(
//Here I'd pass the User resulting from the fetch
))
}
}
My main concern here is whether the event handler will be able to fetch the User
entity. I mean, WHEN does the event handler comes into action? does it wait until the User
entity reduces the first UserCreated
? or is it launched “in parallel”?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Out of order events processing techniques
Out of order events processing techniques · Buffer based approach · Punctuation based approach · Speculation based approach · Approximation based ...
Read more >Event Processing Order | Cribl Docs
Event Processing Order · Sources: Data arrives from your choice of external providers. · Custom command: Optionally, you can pass this input's...
Read more >Event processing order for monitors
Processes events in the order in which they arrive on the context's input queue. * Completely processes one event before it moves on...
Read more >How I am handling out-of-order events - Level Up Coding
IOP — In Order Processing — usually using a buffer to store multiple events which we can later order before actually dispatching them...
Read more >Idempotency and ordering in event-driven systems
Idempotency is a property of an operation that allows it to be applied multiple times without changing the result.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the case of the AWS provider, the event handlers are subscribed to the change stream from the event store, which is DynamoDB. This is the same case for the reducers, so in your example, you could say that they both are launched in parallel.
Oh, I see. Yes, this is a limitation that we should solve, in future versions, we should allow entities to reduce events that are not bound to them. I’ll make sure we have an issue to address that.