Re: [DDD/CQRS] Modeling an approval workflow using a process manager

248 views
Skip to first unread message
Message has been deleted

Chris Sampson

unread,
Jun 14, 2015, 3:08:53 AM6/14/15
to ddd...@googlegroups.com
It does seem like you are on the right track with your process manager here. 

Why would you use your PM to update the projection though? Surely the events from the aggregates can be handled(projected) separately to build the projection:

public class RequestStatusProjection : IProject<VendorRequestSubmitted>, IProject<RequestApprovedByBuyer>
{
    public void Project(VendorRequestSubmitted @event)
   {
       //Request.Status = Submitted
   }
  public void Project(RequestApprovedByBuyer @event)
   {
       //Request.Status = RequestApproved
   }
.....
    

On Sun, Jun 14, 2015 at 1:13 AM, Mahesh <warri...@gmail.com> wrote:
I'm working on a "request approval" portion of an application using CQRS and I'm trying to implement the approval flow using a process manager. At the moment the approval routing is pretty basic:

- A vendor submits a request to become a supplier
- A buyer reviews and approves the request 
- The purchasing dept manager reviews and approves the request
- Send a command to create a new vendor aggregate (separate bounded context)

Is using a process manager a good fit for a scenario like this?

I also need a projection created for showing a list of all vendor requests and their current statuses. As far as I know process managers can only send commands and not publish events, so if I do use a process manager, how would I update the projection "status" field when the request moves from one state into another?

Some commands/events I've drawn up for the system:

Commands:
- SubmitVendorRequest
- RequestBuyerApproval (Sends an email)
- SubmitBuyerApproval
- RequestManagerApproval (Send an email)

Events:
- VendorRequestSubmitted (Send a confirmation email to the requestor)
- RequestApprovedByBuyer
- RequestApprovedByManager

Any help/ideas are greatly appreciated. If my post is not clear enough, I can post additional info/code at your request. Thanks.

--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Kijana Woodard

unread,
Jun 14, 2015, 10:21:38 AM6/14/15
to ddd...@googlegroups.com
BuyerApprovalRequested

From: Mahesh
Sent: ‎6/‎14/‎2015 9:16 AM
To: ddd...@googlegroups.com
Subject: Re: [DDD/CQRS] Modeling an approval workflow using a process manager

This is what I was thinking, but my projection needs to show the next step in the process (until it is finally completed), i.e.

VendorRequestSubmitted -> "Awaiting buyer approval"
RequestApprovedByBuyer -> "Awaiting manager approval"
RequestApprovedByManager -> "Approved

Surely the RequestStatusProjection should not know what the next step should be? 
Reply all
Reply to author
Forward
0 new messages