Manually starting workflows
In the first post of the series we saw how to start a workflow using a WCF service. Furthermore we also discussed doing this using the module’s out of the box mechanisms. So far however, we haven’t had time to analyze the reasons for choosing one method or the other. This post aims to clarify the situation.
As Dennis likes to say, “There is no need to light a cigar with a nuclear reactor”. This is certainly true when it comes to the WCF solution as it can be somewhat unwieldy. In addition we have to come to terms with more technology as it requires configuration for even the smallest task. For example, the client always needs to know the WCF service address. It is also very difficult to work with WF instances because in order to accomplish common tasks (view, track status, generate reports, measure client service reply time) we need to introduce a system of persistent classes which will help to simulate the out of the box behavior. A third issue arises when modifying the solution because there is often a need for changes to occur in many places at the same time. For example when introducing additional properties we have to change client code and Receive contracts.
This option is only recommended when we have a large system (>10000 WF instances). Only then will we notice a gain in performance. This is because one WCF request can start a workflow which costs nothing compared to multiple Sql Queries. In all other cases we are fortunate that XAF allows us to take the easy road as usual!
Out of the box
Take our usual product ordering task; a client simply creates a new OrderRequest business object and fills the necessary members. A workflow with an AutoStartWhenObjectIsCreated condition will start when the object is saved. After that we can access all the information in the workflow algorithm. This method allows us to,
- Track OrderRequest objects since they are just business objects
- Measure client activities using Charts or KPI
- Track sale stages http://it.toolbox.com/blogs/original-thinking/mashup-technology-sales-23755
- Access all the XAF benefits!
Note that a similar process is described in Working with CRUD activities – Short Transactions
We would appreciate your feedback on this post. Has it been useful to you? Feel free to contact us with any further questions