Windows Workflow Foundation - schedule activities to run at certain times

笑着哭i 提交于 2019-12-10 23:58:25

问题


I'm evaluating whether WF would be a good fit for a design I'm working on. I'm in that chicken-and-egg conundrum where I don't want to invest too much time in learning all the details until I have a good idea that it's going to be suitable.

The one thing that I can't seem to find much on that could be significant is scheduling. And by that I mean scheduling of activities to start at a certain time.

E.g. I have a workflow that, on starting, executes the first two activities - but then must wait until, say, 9am the next day before continuing.

I realise I could achieve the same effect by splitting this into two workflows - with the second triggered by, say, a scheduled task. But that would lose much of the benefits of having workflows in the first place - such as seamless persistence of state between activities and guaranteed ordering.

So is there a way to achieve this in a single workflow? Preferably built in to WF (e.g. a WaitUntil activity) - but an alternative might be that the workflow sleeps until recieving an external prod.


回答1:


A Delay activity where you calculate the duration will do that just fine.




回答2:


You can easily accomplish this if you host your Workflow in IIS on WCF with an delay activity adding SQL Persistance to the workflow as well



来源:https://stackoverflow.com/questions/3837950/windows-workflow-foundation-schedule-activities-to-run-at-certain-times

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!