-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use lambdas insterad of command objects? #160
Comments
@olleharstedt it's possible, but I wouldn't recommend it. Message based architectures are all about communication and letting actors respond to commands or requests or events. Passing logic or behaviour around is quite in opposition of that. But since EventSauce doesn't ship with command infrastructure, you can do what you like of course. |
Ah. I'm looking for a more lightweight way to remove side-effects from business logic, and I was thinking an event queue would fit. I'll keep looking. :) Thanks. |
An event queue would fit, but the logic should be in the consumer, not the payload |
I'm struggling to express a DSL in PHP without massive amounts of boilerplate. A builder pattern works best: $user = new User();
// ... set properties
$st
->if(fn () => $user->save())
->then(fn () => /* Do something */)
->else(fn () => /* Throw exception? */);
// ... more logic
$st->run(); // Execute all events I don't think it'd be ergonomic to create a command for every model and database interaction, like SaveUserCommand, SaveBlogCommand, etc. Edit, oh, you use code generation for that. Neat. :) |
Quick question, but is it possible to push lambdas or closures onto the command queue instead of command objects?
The text was updated successfully, but these errors were encountered: