Thanks for the quick reply and sorry for the slow follow up. I was experimenting with your suggestions and some other ideas.
In the previous example, the user account creation complete notification is wired up to the create mailbox command. The solution does work well. However, I do see some disadvantages with this approach:
1. The user account proxy didn't used to have knowledge of mailboxes. Now it needs to add a parameter to pass data around with which it has nothing to do. The more of these workflow-ish commands are added, the more unrelated data has to be passed around.
2. It puts business logic in the notification wiring, where it doesn't belong. The ability to create a mailbox after a user account now also needs to be coded into the ApplicationFacade notification wiring, and in the user account proxy (which passes the data around). For this simple example this is no problem, but for a large application the number these dependencies becomes ugly.
3. I found myself adding notifications for the sake of wiring commands together. Maybe I'm being picky but it feels like the notifications are used to fill in for a missing part.
So, how to pass data around in a manner that scales, while still honoring the stateless command principle?
I'll try by generalized your suggestion a little as follows:
Instead of passing the mailbox info to the create user account proxy, an array is passed with a set of proxy functions and parameters. The result handler of the proxy takes the next proxy function from the array and calls it, passing in the parameters and the remainder of the array. This repeats itself until all proxy functions are called.
With this approach each Command can build a set set of proxy functions that need to run sequentially. The model proxy's don't need to know any details of follow-up action, just support the ability to pass such actions through.
I'm still not completely happy with this solution because passing in the proxy function array adds an artifact to proxy functions that doesn't belong there because it isn't needed to perform its function. The burden of serializing asynchronous commands doesn't belong in model proxy's nor does it belong in the facade wiring. Still, I take this last approach as the lesser of the two evils.
Alternatively, a proxy aggregate class can do it all. It can be used to build up multiple proxy commands, can be a responder for each proxy function, and sequentially call the proxy functions.
Thanks for the discussion Cliff and Rhysyngsun. I really appreciate your feedback and hope you can keep sharing your thoughts.