Git Product home page Git Product logo

Comments (4)

frankdejonge avatar frankdejonge commented on June 26, 2024

@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.

from eventsauce.

olleharstedt avatar olleharstedt commented on June 26, 2024

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.

from eventsauce.

frankdejonge avatar frankdejonge commented on June 26, 2024

An event queue would fit, but the logic should be in the consumer, not the payload

from eventsauce.

olleharstedt avatar olleharstedt commented on June 26, 2024

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. :)

from eventsauce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.