Workflow runtime hosting questions

We're interested hosting a single workflow runtime to manage all our workflow instances. These workflow instances are mostly human user approval processes that could span days. The primary method GUI for approving/rejecting will be through a web application. If I implement my workflow runtime in a Window Service how difficult would it be to access the runtime instance. Can the workflow runtime be remoted by a web app or web service? I have looked at implementing a workflow as a web service but they seem better suited for short-lived sequential workflows. I'm curious how SharePoint v3 implements the workflow runtime. I read that they use a specially tailored web service to broker the workflow runtime calls but I am not sure where the runtime is hosted.

Does anyone have any opinions or examples how I could accomplish some of my needs.

Thanks... -Paul

[908 byte] By [PaulCzy] at [2008-2-5]
# 1
PaulCzy wrote:

We're interested hosting a single workflow runtime to manage all our workflow instances. These workflow instances are mostly human user approval processes that could span days. The primary method GUI for approving/rejecting will be through a web application. If I implement my workflow runtime in a Window Service how difficult would it be to access the runtime instance. Can the workflow runtime be remoted by a web app or web service? I have looked at implementing a workflow as a web service but they seem better suited for short-lived sequential workflows. I'm curious how SharePoint v3 implements the workflow runtime. I read that they use a specially tailored web service to broker the workflow runtime calls but I am not sure where the runtime is hosted.

Does anyone have any opinions or examples how I could accomplish some of my needs.

Thanks... -Paul

I wanted to bump this to try to get some thoughts, it seems like a popular topic by the number views.

PaulCzy at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
You should consider hosting the workflow runtime in ASP.NET. There is a rudimentary sample of interacting with ASP.NET in LAB 7 if you download our Hands-on Labs.

I don't agree that web services in workflow are better suited to short lived sequential workflows. It's all in how you design the workflow.

The version of sharepoint in Office "12" will host the workflow runtime. I don't know exactlt which process this is implemented in - but it is a server product and would be a good candidate for your project.

PaulAndrew at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Would that work anyway? Hosting the workflow runtime in an asp.net application, when the user approval process lasts a couple of days? Because the website won't be up and running all the time?

I'm thinking about the same issue, and I consider hosting the workflow in a windows service is the best option (for long term running processes, in web applications).

Or does someone know more about that?

jamba8 at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

actually, when the workflow is in idle state it can be persisted to the db and reloaded later if you know its instanceID.

Serge Luca

www.redwood.be

Guidance, Belgium

SergeLuca at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

ok. that's true.

but in some cases, things are happening, which dont respond with the website. For example if a certain amount of time is exceeded, an escalation email should be sent. this would not happen, if the website is down.

imho, if you have human interaction, as well as other not human interacted processes, it's rather practical using a windows service than an asp.net webapplication.

cheers

jamba8 at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6
This is an interesting point. I am interested in find out more about this aspect of hosting workflow in web services and whether it can be mitigated? Are windows services the "best" option for delivering long running human centric workflows? I would like my workflow to be accessed by multiple clustered web servers and follow an SOA deployment model. The workflow will be running multiple instances of the same workflow simultaneously and the workflow may need to invoke externally hosted webservers. Scalability is very important as well. I've been reading about the WF hosting options over the last couple of days but I am not clear on what the best hosting model for my needs would be. Does anyone have any comments or suggestions?
SteveNesbitt at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 7

this is an interesting topic. I am also searching for a possibility to host a long running workflow which should be exposed on a server via services (wcf in aspnetcompatibility mode). So far I kept the runtime in an Application variable. But now I have to add a Listen Activity with a Delay activiity in it which escalates for example after 3 days, and so I have a little problem with my "state", because if the workflow instance gets frozen as a result of an Application Ending, how should the instance know when the 3 days are over.

If somebody knows a better way I would be very appreciated. Thank you.

simon at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 8

Simon,

For what it's worth, we decided that a Windows Service workflow host would be the best option for us to host our long running workflows. We considered a WCF link between the Windows Service and the exposed Web Services, but in the end we went for a solution that passed messages via a database table that we poll periodically.

As far as notifying the workflow instances when an escalation condition is met, I understand this is the responsibility of the Timer service you add to your runtime. You have a number of options for how the Timer service keeps track of these deadlines (in-memory, ASPNET or SQL) depending on your requirements.

SteveNesbitt at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 9

"a WCF link between the Windows Service and the exposed Web Services"
=> Yes, this is the way I am thinking to realize my szenario. Do you have a little code example how I can realize this?

"You have a number of options for how the Timer service keeps track of these deadlines (in-memory, ASPNET or SQL) depending on your requirements."
=> Can you also give me a short example of doing this?

Thank you very much for your help Steve.

Simon

simon at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 10

Hi Simon,

Our WCF idea didnt see the light of day so I dont have any code examples for you, I'm sorry. We chose an alternative way of communicating with our workflow runtime by passing messages via a database and having the runtime poll it periodically. This approach had some advantages in our scenario, but WCF did seem like an interesting approach. There are plenty of samples and examples on the WinFX website to get you started.

As for the timer service, I am still playing with this myself. When I have something concrete I'll drop you an email.

Steve

SteveNesbitt at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 11

Thank you very much Steve. I already found a way to implement the workflow runtime within a windows service via WCF by the help of our microsoft friends. I wrote a little tutorial how I realized the application. You can read it here on my blog.

Best regards

Simon

simon at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 12

Simon,

Nice blog entry.

Just wanted to post a quick followup - my previous post about the Timer service was a bit of date. In 3.0 the timer is related to the persistence service, and by simply specifying the LoadIntervalSeconds parameter when loading the persistence service, the runtime will use this value to poll the db and find any events that are due for unloaded workflows.

NameValueCollection persistenceParams = new NameValueCollection();

persistenceParams.Add("ConnectionString", "Data Source=(local);Integrated Security=SSPI;Initial Catalog=WFPersistence");

persistenceParams.Add("UnloadOnIdle", Convert.ToString(true));

persistenceParams.Add("LoadIntervalSeconds", Convert.ToString(10));

wfRuntime.AddService(new System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService(persistenceParams));

SteveNesbitt at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified