Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Márk Sági-Kazár
    @sagikazarmark
    I see
    Christopher Davis
    @chrisguitarguy
    Or if it's possible to have a single command and simple not care whether it happens now or later when calling $bus->handle(new DoStuff());
    Márk Sági-Kazár
    @sagikazarmark
    There is absolutely no need for multiple command classes for one command
    The only requirement is that you implement Bernard\Message interface
    which AFAIK only contains a getName method which is not a big trade of
    Christopher Davis
    @chrisguitarguy
    right
    Márk Sági-Kazár
    @sagikazarmark
    the reasons behind this
    :
    Christopher Davis
    @chrisguitarguy
    So on the consumer side of things you'd just not put in the benard middleware into the command bus right?
    Since doing so would mean the messages would just constantly get requeued?
    Márk Sági-Kazár
    @sagikazarmark
    1. During development you SHOULD be aware of your architecture and know which commands will POSSIBLY be sent over the wire to bernard (these are usually long running tasks, or commands in complex systems)
    2. We had to make a deal whether we send ALL commands to bernard in the middleware or make it somewhat controllable
    3. Instead of creating a command wrapper (which would have increased the necessary serializing) we just require the Message interface to be implemented which also marks that it should be sent to Bernard if the queue middleware is in the chain
    actually you have two ways (currently) to do that
    those who want to use the same command bus for both the producer and the consumer side can register the SameBusReceiver in the Bernard router
    those who want to use separate buses for producer and consumer should register the SeparateBusReceiver
    (I am in favor of the latter, @rosstuck favors the first option, that's why both is available ;))
    Christopher Davis
    @chrisguitarguy
    Gotcha, wasn't clear to me how the SameBusReceiver worked when I first looked. Makes a lot more sense now.
    Márk Sági-Kazár
    @sagikazarmark
    The problem you noticed is that the receiver needs an instance name (interface, class, etc)
    Actually the router needs it to register a receiver
    Christopher Davis
    @chrisguitarguy
    Right, should be easy to do with my own marker interface (or otherwise) for now.
    Márk Sági-Kazár
    @sagikazarmark
    Yup
    But you can also use Bernard\Message I guess
    I think we are going to have a marker interface of our own
    Which helps you
    Discussion in #26
    Christopher Davis
    @chrisguitarguy
    Yep, I was following along with that.
    I think you guys should just wrap it as it goes into the queue and get rid of the two receivers (in favor of one)
    $producer->produce(new QueuedCommand($command));
    which increases the serialization overhead
    Márk Sági-Kazár
    @sagikazarmark
    Yeah, it does
    Christopher Davis
    @chrisguitarguy
    but you wouldn't have to have two buses
    er, receivers
    Márk Sági-Kazár
    @sagikazarmark
    Actually I am thinking about adding a compatibility command for those who want to use it
    Christopher Davis
    @chrisguitarguy
    since you can check for your queuedcommand instance (just make it final)
    Márk Sági-Kazár
    @sagikazarmark
    But we would still need receivers to register the bus as a handler for the message
    And that overhead is not necessary when someone doesn't want to use the same bus for the consumer
    Christopher Davis
    @chrisguitarguy
    True
    makes your middleware something like this probably: https://gist.github.com/chrisguitarguy/f0d59a4146b406191462
    (this gitter thing is badass, this my first time using it)
    Márk Sági-Kazár
    @sagikazarmark
    ;)
    Christopher Davis
    @chrisguitarguy
    just swiches where the queuedcommand is used
    Anyway, thanks for the help.
    Márk Sági-Kazár
    @sagikazarmark
    I would rather let the user choose the way, so command wrapping should be a choice of the user
    Actually the QueuedCommand would have to implement Message interface to work
    That's why I want to make it another command
    Christopher Davis
    @chrisguitarguy
    Yep, it would. So you just proxy getName to the wrapped command
    Sam Greenwood
    @samgreenwood
    anyone around who can provide some insight into getting bernard and tactician hooked up 'properly'? seems like im going around in circles just trying to make sense of how this was designed to work
    Márk Sági-Kazár
    @sagikazarmark
    Hi Sam
    Here is an example I used as a demo at a conference in 2016
    I believe bernard dev-master changed since then, so might have to lock to a bit earlier version