locked
SynchronizationScope between workflow instances on a single host RRS feed

  • Question

  • Hi,

    I need a synchronization mechanism that can lock a shared resource across all workflow instances on a single host. I tried using SynchronizationScopeActivity, but I can't seem to get it to work outside of ParallelActivity and across multiple workflows.

    I remember reading that one can provide a static object as the SynchronizationHandler to produce a lock across workflow instances; however, I cannot find any code sample that demostrate this.

    Any idea?

    Thanks,
    Mark Liu



    Thursday, August 2, 2007 7:47 AM

Answers

  • If you’re sharing a resource across workflow instances, then it’s probably in the form of a runtime service – it sits in the host and different instances can access it (or modify it) simultaneously.  In this case, the locking is the responsibility of the runtime service, which is nothing specific to workflow.  Sync Scope activities are for locking/syncing within a single workflow instance.

     

    Remember also that individual instances are agnostic of peer instances.

     

    Wednesday, August 15, 2007 12:23 AM

All replies

  •  

    You can pass synchronization object as a parameter to workflow and use it when needed. Or you can create workflow  service, which creates sync object on start of the service and in workflow you can get this service and obtain sync object from that service at the time you need it.

     

    Does this solve your poblem?

     

    Thanks,

    Konstantin.

     

    Sunday, August 5, 2007 12:03 PM
  • If you’re sharing a resource across workflow instances, then it’s probably in the form of a runtime service – it sits in the host and different instances can access it (or modify it) simultaneously.  In this case, the locking is the responsibility of the runtime service, which is nothing specific to workflow.  Sync Scope activities are for locking/syncing within a single workflow instance.

     

    Remember also that individual instances are agnostic of peer instances.

     

    Wednesday, August 15, 2007 12:23 AM
  • I ran into this same problem. See http://www.codeplex.com/RealSynchronization for a solution to this problem (caveat: it (currently) only works for non-persisting in-memory workflow runtimes).
    Monday, April 28, 2008 6:22 PM