Search code examples
c#workflowworkflow-foundation-4

Workflow service - bookmarks not resuming


I have a very simple workflow service created using WF 4.5, that I'm running from a console app in VS.NET 2012 (added a service reference). In the WF service, I have a single ReceiveActivity that creates an instance of the service and then immediately after invokes a NativeActivity which uses a FileSystemWatcher/bookmarks to monitor a directory for incoming files. Two issues arise:

  1. The workflow goes idle and never gets resumed when the file actually is dropped into the folder. The service goes idle/shown as such in the persistence store, but is never resumed.

  2. This is a whole separate issue, but what I ultimately need to accomplish is to also institute a warning/error timeouts if the file isn't there within a given timespan. Seems like creating a Pick activity with three branches (two delays and the actual file monitor activity) is the way to go; does this sound right?

I'm not sure how to get # 1 above working and/or there's a better approach. Any thoughts/advice would be greatly appreciated - thanks in advance!


Solution

    1. You are watching for files, you have to resume the bookmark when you see a file.
    2. Not quite. If the warning timer goes off, the other two branches in the pick are canceled so, your error timer would never go off.