This is where the listeners come in. You have to broadcast the new order, then the event listener will pick that up and you could then have one event that handles Stripe, one that saves the order, on that emails a confirmation and so on. Watch the Commands and Domain Events series a few time and you'll pick it up!
Command Bus doing too much
I am in the middle of building an ecommerce site and have been implementing the command bus process. I am curious how you guys might handle the situation when creating an order.
My current process is this: 1. Post to order controller 2. Fire up command bus passing in all form data from checkout process 3. In the command handler (this is where I am curious), I am sending a request to my stripe service for the payment, then sending a request to my order repository to store the order header than a request to my orderItem repository for each item in the cart.
I am wondering if/how I might be able to break this process up a little instead of doing all of this in one handler.
Everything works as is, I'm just looking for some insight from everybody.
Thanks in advance!
Please or to participate in this conversation.