I want to create a WCF service that is hosting a Workflow and I see a lot of examples/tutorials but they are so simple and useless. Could anyone help me to explain:
1) What is best practice to host a Workflow in WCF?
2) Based on answer in 1) Is it possible to receive parameters from a client, start a Workflow and return an response with the workflow-result?
3) Based on the two previous answers, if the workflow needs to be persisted, could you send a response to the client before persisting and resume the workflow some days later? Lets take an example:
Users should be able to send in data, sometimes the process of handling the request could take some time and needs to send a response to the user that the data is received but they must check for updated status later:
- Client invoke my service with some information as input.
- My WCF receives the information and starts a workflow that needs to be persisted for some time, I want the user to get an response immeaditly because I cant let the client wait for the response.
-After a few hours the workflow resumes and perform some updates in a database etc.
- The client may some hours or days later check if status has changed by performing another service call (that does not need to be part of the workflow) to check status.
4) After a periode I want the the WF-runtime to check if there is some WF that has been persisted to be re-runned, continue from where it was persisted. This must be automatic and not initialized from a user.
1. Base on your description, I'd suggest you use WCF Workflow service instead of manually host workflow in WCF service to fit your requirement.
2. It can be done by using a pair of Recieve and SendReply activities.
ReceiveAndSendReply Template Designer
3. You should be able to achieve this by using Parallel activity combined with asynchronous activities.
The Workflow Parallel Activity and Task Parallelism
With SQL Workflow instance store, Workflow runtime will detect the runnable workflow instance automatically. For the detailed information, please refer to:
Persistence Best Practices
- Ditandai sebagai Jawaban oleh NorwegianEcho 02 Mei 2012 6:46