Shared Receive Trigger RRS feed

  • Question

  • I have a .Net 4.0.1 self host WorkflowServiceHost.

    I would like to have a Receive Activity as a shared trigger for multiple state transitions

    var ReceiveResult = new Variable<bool>(); var ReceiveTrigger = new Receive { Content = ReceiveContent.Create(ReceiveResult), ... // Some other initializers }; var state1 = new State { ... }; var state2 = new State { ... }; var state3 = new State { ... };

    var state4 = new State { ... }; state1.Transitions.Add( new Transition { To = state2, Trigger = ReceiveTrigger, Condition = ExpressionServices.Convert( e => ReceiveResult.Get(e) ) }); state1.Transitions.Add( new Transition { To = state3, Trigger = ReceiveTrigger, Condition = ExpressionServices.Convert( e => !ReceiveResult.Get(e) ) });


    new Transition


    To = state4,

    Trigger = new Delay {...}


    However, when a message is sent to the workflow it gives the following error:

    "The execution of an InstancePersistenceCommand was interrupted because the instance '7fa6975f=ba34-4e87-85fe-96b787241f20' has not yet been persisted to the instance store"

    If I remove the second transition, such that the Receive is only being used in one location, then the message is received properly.

    Any ideas?

    • Edited by Ben112358 Monday, July 9, 2012 3:39 PM
    Monday, July 9, 2012 3:33 PM

All replies

  • Hi,

    How did you create the workflow instance? Did you allow the Receive Activity to create instance?

    If you don't allow the receive activity to create instance, I think you need to configure correlation to send multiple messages to the same workflow instance.

    Wednesday, July 11, 2012 10:32 AM
  • At the top level of the Workflow, I have a sequence with a receive activity and the state machine. This receive activity has canCreateInstance = true. All the receives inside the state machine, such as ReceiveTrigger shown above, have canCreateInstance = false and use context correlation.


    Wednesday, July 11, 2012 5:28 PM