DelayActivity dynamic update

Hello,
I would like to ask you if it is possible to update DelayActivity.TimeDuration value when DelayActivity is executing I want to achieve scenario like this: workflow is configured to simulate delay specified in the DelayActivity. After DelayActivity starts waiting, user wants to change delay value for the running instance (increase or decrease the delay value).
Applying WorkflowChanges to the running workflow instance with different DelayActivity.TimeDuration value set does not work (no errors, old delay value is respected).
I was also trying to remove DelayActivity from the running workflow instance and recreate it with different TimeDuration value, but exception is thrown when I try to remove running DelayActivity from the workflow.
Any ideas/suggestions on how to achieve the described behavior
Thanks in advance
Edmundas


Answer this question

DelayActivity dynamic update

  • FLee

    I have a similar problem. See http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=416585&SiteID=1

    Have you solved this by now If yes, I would appreciate if you would share your solution.

    Thank you


  • John Kimball

    Dynamic update will not let you acheive this functionality, since it doesn't allow property updates. Once delay activity had started executing, the new timeout value will not be taken into account, even if property is updated.

    Could you give more context for your scenario Many delay based scenarios can be successfully modeled using EventHandlersActivity.

    Thanks,

    Andrei



  • kingtaj

    Hello Andrei,

    Let's say workflow "wake-up" time is a configurable option and can be modified by the user. It can be changed several times, i.e. initial value - wake up after 2 hrs, and later updated to 0.5 hrs.

    Firing events to the workflow requires tracking the "wake-up" time somewhere, my idea was to use DelayActivity in order to avoid this tracking, as it would have been done by the workflow engine it self.

    Thanks for the hint about EventHandlersActivity, I will take a look at it.

    Edmundas


  • d3v

    Hello Edmundas,

    I can see 2 options of modelling this behavior.

    Option 1. Use the following activity structure to handle changeable delay. EventHandlingScopeActivity, containing EventHandlersActivity, containing EventDrivenActivity, containing DelayActivity. In this case the EventHandlersActivity has enough machinery to handle a dynamic update, which would remove executing EventDriven with a Delay, and then add a new Delay-based EventDriven.

    Option 2 is to implement a custom Delay activity, which exposes change timeout method. In this method custom activity should remove previous timer subscription and set a new timer.

    Which option to choose, depends on your project. I'd probably prefer option #2, since it seems to give a better isolation between workflow logic and internal implementation.

    Thanks,

    Andrei



  • DelayActivity dynamic update