locked
WF4 schedule an activity RRS feed

  • Question

  • Hi,

     

    I need a clarification related with the possibility of schedule an activity:

    1 - Can I schedule an activity to run in 2 hours from now? How?

    2 - Can I trigger an activity that has been schedule only to run in the next 2hours to run now? How?

     

    Thanks,

    BeFFes

    Friday, February 4, 2011 11:07 AM

Answers

  • Hi,

    >>1 - Can I schedule an activity to run in 2 hours from now? How?

    You can use the Delay activity to have a workflowwait two hours before performing an action.

    >>2 - Can I trigger an activity that has been schedule only to run in the next 2hours to run now? How?

    You can use a Pick activity with two pick branches, one with a delay activity, and the other that will receive an exptenal event. (If this is a WCF Workflow Service, this could be a correlated receive message activity.)

    For these scenarios you should look at using a persistence store, as the workflow state will be lost if the host process restarts. For WCF Workflow Services, Windows Server AppFabric can provide this.

    Regards,

    Alan


    http://www.CloudCasts.net - Community Webcasts Powered by Azure
    • Marked as answer by beffes Friday, February 4, 2011 11:38 AM
    Friday, February 4, 2011 11:32 AM

All replies

  • Hi,

    >>1 - Can I schedule an activity to run in 2 hours from now? How?

    You can use the Delay activity to have a workflowwait two hours before performing an action.

    >>2 - Can I trigger an activity that has been schedule only to run in the next 2hours to run now? How?

    You can use a Pick activity with two pick branches, one with a delay activity, and the other that will receive an exptenal event. (If this is a WCF Workflow Service, this could be a correlated receive message activity.)

    For these scenarios you should look at using a persistence store, as the workflow state will be lost if the host process restarts. For WCF Workflow Services, Windows Server AppFabric can provide this.

    Regards,

    Alan


    http://www.CloudCasts.net - Community Webcasts Powered by Azure
    • Marked as answer by beffes Friday, February 4, 2011 11:38 AM
    Friday, February 4, 2011 11:32 AM
  • Hi Alan,

     

    Thank you for the quick answer.

    I will try the pick activity and test if I can work with.

     

    Thanks,

    BeFFes

    Friday, February 4, 2011 11:38 AM
  • Hi again Alan,

    Debuging the pick activity is it possible using WCF Test Client to call the pending activity?

    This is because when I call the pick activity the branch with Delay "blocks" the activity so I can't call it again to force the receive action(I've created a simple project with a pick activity with persistence).

    Only when the delay finish I'm able to call again!

    Thanks,

    BeFFes

    Friday, February 4, 2011 12:39 PM
  • Hi,

    You should have two pick branches in the activity, in the triggger of one a delay, in the triger of the other a receive and send reply. You sould be able to call the method of the receive and send reply in the second pick branch.

    Regards,

    Alan

     


    http://www.CloudCasts.net - Community Webcasts Powered by Azure
    Friday, February 4, 2011 1:19 PM
  • Hi,

     

    I just got it... it didn't had to do with the branches but what activity I was calling...

    The problem was that I wasn't calling the Receive Action inner the pick branch but the outside activity... sorry!

     

    Thank you...

    Friday, February 4, 2011 2:33 PM
  • Hi Alan,

    I have a similar scenario but with 3 pick branches. First branch waits for user input and the other two contains Delay activities. The delay activity in the second branch is used to send alerts to the user if he is not responding to the task. Finally the delay activity in the third branch will terminate the workflow when it reaches the timeout period set for the task. Now my problem is that the third branch is not executing even if exceeds the timeout mentioned in the task. First 2 branches are working fine, I'm able to approve the task and also i'm getting the notification when the task is unattended for certain period of time.

    Please help me in figuring out the issue.

    Can pick activity have delay in 2 branches and is it supported in WF4?

    One more question regarding durable delays. I'm using WCF workflowservice (xamlx) in my application.

    Is it necessary to configure the "sqlWorkflowInstanceStore" to enable durable delay?

    What will happen if I didn't use that configuration if my workflow has a delay with long duration say 20 days?

    Thanks in advance.

    regards,

    Rajesh KR

    Monday, October 21, 2013 9:54 AM
  • My pick activity is inside a while activity which is resetting the third branch's delay timeout during each iteration. Now I handled it by not calling the delay in third branch using a flag and an If statement. Its working as expected now.

    Thanks.

    • Proposed as answer by krrajesh Wednesday, October 23, 2013 2:39 AM
    • Edited by krrajesh Wednesday, October 23, 2013 2:42 AM
    Wednesday, October 23, 2013 2:39 AM
  • However it would be great if someone answer my second part of the question.

    copied from previous post : [One more question regarding durable delays. I'm using WCF workflowservice (xamlx) in my application.

    Is it necessary to configure the "sqlWorkflowInstanceStore"to enable durable delay?

    What will happen if I didn't use that configuration if my workflow has a delay with long duration say 20 days?]

    Thanks in advance.

    regards,

    Rajesh KR

    Wednesday, October 23, 2013 2:41 AM