locked
sharing data between workflow during execution RRS feed

  • Question

  • Hello,

    I have number of workflows which are running at the sametime. I have a activity that gets the file from a remote location. It is possible that multiple workflow might require the same file. Is it possible, that once a given workflow has requested for the file, and if someother workflow wants the same, instead of looking for file, it waits for it, when the other workflow has downloaded the file, then it can use the same file.

    Similarly i have workflow loading files to a dataset, it is possible that other activity might want to load the same to a dataset

    can somebody please point to me, how can i do it, i have read about extension, but I am not able to find any documention, thats shows how can i use them for sharing information between workflows.

    Wednesday, September 15, 2010 8:40 PM

Answers

  • It sounds like you want to have some sort of "file management" class in your host application that workflows use to gain access to that file. if it the file is in use then the service would queue up the request, and then signal the workflow once the file was ready. You could use a workflow extension for this sort of thing. What application type is your workflow host? And in that host are you using WorkflowApplication, WorkflowInvoker, or WorkflowServiceHost (if it is a workflow service)

    Here is a link with a sample of a workflow extension:

    http://xhinker.com/post/WF4Using-WF4-Customized-Extension.aspx

    Here is another one that has some good explanations too:

    http://blogs.msdn.com/b/tilovell/archive/2010/06/08/wf4-workflow-4-0-hosting-extensions.aspx

    Basically your custom activity would ask the file management component of the host if the file is available (via calling a method on the extension). This extension would manage the sequential access to the file. if the file is ready then, then the activity could do the processing on the file, and then call back to the extension to release the file for the next caller. if the file is not ready, the activity could create a bookmark, and wait to be called back when the file is ready.

    For an example of an activity with a bookmark, see Step 1 of the Getting Started Tutorial for WF.

    Let me know what type of host and which class you are using to host your workflow and I can provide more details if needed.

    Thanks,

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

     

    • Marked as answer by Andrew_Zhu Thursday, September 23, 2010 6:21 AM
    Thursday, September 16, 2010 6:15 PM