Ian Yates
Ian Yates

Reputation: 941

Alternative to WorkflowServiceHost for WF4?

We're looking to replace a chunk of our business logic with WF4 workflows.
They're all pretty typical workflows: User action creates an instance, database effort, next user confirms, etc.

Our requirements for the workflow host are:

  1. Create workflows from XAML definitions stored in a database (DynamicActivity)
  2. Support workflows on different versions
  3. Support long time-based events (we're currently aware of notifications after 5 days and rolling back a workflow after 30 days)
  4. Support many instances of many workflows (we've identified 10 workflows with about 4000 in-flight, of which only a few are processing at any one time)
  5. Retain all state after a service restart (including the time-based event)
  6. Authenticate the calling user (WindowsAuthentication, if possible)

As part of the migration effort, I built some POCs using "WCF Workflow Service Application" projects, but from what I can see these aren't immediately possible.

I've got that #2 is done through WCF Routing, and my understanding is that WSH will handle #3 for us (is this true, given #5?), but I can't see how #1 would work from the default project structure.
I've solved #1 using WorkflowApplication instances, but this relied on using bookmarks to resume for each input event, and I wasn't convinced that WorkflowApplication would scale to our needs without unloading idle workflows, which breaks the Delay activity.

So, if you've stuck with me this far:

I'm not averse to writing our own host service to handle workflow lifecycle, and we've even drawn up the proposed design, but I didn't want to start down that route if it turns out that there is a ready-made solution.

Cheers

Upvotes: 3

Views: 1366

Answers (2)

Fabske
Fabske

Reputation: 2126

I'm developing the same kind of workflows.

I also first gave a look to workflow services, but as our workflow were completely integrated in a business layer, I didn't want to use WCF to access workflows.
So I'm now using WorkflowApplication as host, so I can instantiate and manipulate the host.
Biggest problem was resuming workflows that use a delay activity (you need to check yourself in the database)

Upvotes: 0

João Angelo
João Angelo

Reputation: 57718

You can achieve #1 by using a VirtualPathProvider to load your workflows from a database instead of the file system. See How To Build Workflow Services with a Database Repository for more information about this.

Workflow versioning (#2) is something that is not supported in .NET 4.0, but in .NET 4.5 you have better support for real versioning. See What's New in Windows Workflow Foundation 4.5. However, if you don't need to change a workflow after it starts and just need that new instances start with a new version while already executing instances can finish using a previous workflow definition then you can implement versioning at the database level and just treat each workflow definition version has a different workflow service.

You can then use Workflow Services hosted in IIS (AppFabric) with a SQL Server instance store to get #3, #4 and #5 almost for free.

Finally for #6 and assuming you stick with .NET 4.0 you can take a look at WF Security Pack CTP 1.

Upvotes: 1

Related Questions