By Serge Luca
- New version of WF: WF4
- WCF-WF integration
- Our workflows can run in the cloud
- New host for WF (not just for WF) : Dublin (will ship just after VS2010)
- New language family: M
- Oslo : focused on Modeling (creation & storing)
- Office 14/Sharepointx will be based on WF 3.5
- What do you need to do next ?
1.New version of WF: WF4
The Workflow Foundation team has recreated WF ; they started from the ground up !
What’s new in WF4 ?
- Authoring is simpler and takes much less code
- Fully declarative workflows and activities expressed in Xaml (Event handler, data management, expressions, rules…). Detail: .xoml files have been renamed .xaml…) ; to author the workflow or the activities code, we can :
- use the visual Designer
- directly write Xaml code
- use the Oslo M language combined with a xaml parser to generate Xaml code
- Alignment across Expressions, Rules, and Activities
- Seamless Composition Across Flow Styles
- New paradigm after sequential Workflow and State machine workflow : the FlowChart (see Fig 1)
[Fig 1.Flow Chart activity, designer usability improved; from Kenny Wolf PDC2008 session]
- An activity can have arguments (fig 2); arguments define the activity signature. Arguments have a type (any type), a name and a direction(in, out, in-out).Arguments are successors of dependency properties.
[Fig 2.Activity arguments: here the WinPrize activity has 3 arguments; from Kenny Wolf PDC2008 session]
- Activities can share data with other activities by using variables:
[ Fig 3.Variables available in the activity; from Matt Winkler PDC2008 session]
For instance, in fig 3, Generate Order activity can bind its arguments on Sequence and State Machine activity, and Send Report activity can bind its arguments on State Machine only.
In the next picture for instance we have 3 activities: Sequence, CollectVotes and AnalyzeVotes; CollectVotes has 3 arguments : Polling Place (In), ElectionDate (In) and Votes(Out); the AnalyzeVotes activity needs to get the Votes: to achieve this, we can define a Votes variables in Sequence and we can store de Out Votes arguments into the Votes variables; when Sequences closes we won’t need the variable anymore, and it’s not necessary to persist the data as we would have done in WF3.0/3.5.
[ Fig 4. Arguments and Variables;from Matt Winkler PDC2008 session]
- The arguments and variables of the currently running activity define the active state of the workflow (and only this state will be persisted, not the whole workflow as before).
- The activity state model has changed :
- The activity state model is different (simpler, but compatible with the 3.0/3.5 activity model) (Fig 5): Initialized state, Compensating state seem to be gone.
- 4.0 activities are derived from a new class WorkflowElement:
[Fig 6. An activity is a WorkflowElement]
System.WorkflowModel.WorkflowElement can interact with the runtime (via the SystemWorkflowModel.ActivityExecution context)
->There are now 2 blocks of execution : Activities and WorkflowElements; we can schedule a WorkflowElement.
- We will be able to run 3.0/3.5 activities alongside 4.0 activities by using a new kid on the block, the Interop activity.
- Code activities are gone, the Initialize method is gone.
- WF 4 activities will run on the CLR 4.0
- The WorkflowInvoker.Invoke method allows you to run an activity directly (not through the workflow), which is great for unit testing.
- 10-100X Performance Improvements :
- execution speed
- the persistence services doesn’t always persist the whole workflow anymore, but just the state of the running activity (the state is the variables + the arguments of the activity) –>more efficient
- activities can be multithreaded, the scheduler is still single threaded. We can now create scalable systems by using the APM (Asynchronous Programming Model): this is not recommended in WF 3.0/3.5 because we don’t have any guarantee that when the operation returns the worflow is still there; in WF 4.0 we can use the SetupAsynchOperationBlock() method of theWorkflowExecutionContext class.Even if the asynch operation returns when the workflow is persisted, the workflow runtime is smart enough to rehydrate the workflow. Under the cover the asynchronous activity will leave the scheduler thread and will be replaced in the scheduler thread when to operation return. Same logic for real parallel activity.
- Full control over persistence :
- we can persist the workflow without unloading it,…)
- we can define no persist zone (zone of the workflow where persistence will not occur, interesting in some asynchronous operations)
- persistence state can be schematized : we can store some variables in some specific places : for instance purchase orders can be stored in a specific table.
- Flow-in Transactions : the workflow runtime knows when the host is running in a transaction and can transmit the transaction context to the activities; of course if the transaction is aborted the workflow state will be rolled back to its previous state.
- Partial Trust Support (was full trust in WF 3/3.5)
- Integrates with WCF, WPF, ASP.NET
- Designer Performance and Usability (fig 1). The designer is now based on WPF, but won’t be hosted in Silverlight in VS2010. This will probably be possible after VS2010…
- Re-hosting Improvements ( 3 lines of code to rehost the WF designer in your application instead of several hours of coding in WF 30/3.5)
- Unified Debugging Experience (we can step into expressions, rules, xaml based event handler… ).
2.WCF – WF Integration
- Message Correlation (message related to each other and to the workflow instance, fig 7) :
- WF 3.0 : Channel (transient).
- WF 3.5 : WorkflowContext (based on cookie/soap) (improvement in WF 4.0 : it can work over one way messages.
- WF 4.0 : WorkflowContent : you can use your own value to specify the correlate messages and workflow instances. A Correlation Query allows to specify the value of the correlation and is used for inbound and outbound messages. The workflow Dispatcher will retrieve the correlation value and associate the message with the workflow instance. The correlation value is associated with workflow in the Instance store; This correlation values provide a unified correlation mechanism across WF3.0-3.5-4.0
- Management Endpoint
WCF also provide a management endpoint to allow better workflow management (cancelling workflows, resuming workflows,…); this Management Endpoint is also used by Dublin.
3.Our workflows can run in the cloud
The Windows cloud based operating system has been renamed "Windows Azure", and yes David Cutler, the hero of VMS and NT, is one of the main architect) .
That is Workflow Services, a subsystem of the new .Net services wich provides an workflow off premises host.
The benefits of this off premises host are :
- Avalability :
When you run your workflows in Azure .net Service, actually several instances of your workflow will run, duplicated in several nodes; if one node crashes, the system will use the instance running on another node.
- Infrastructure maintained by Microsoft
- Accessible from anywhere :
We can access and manage our workflows from anywhere
You can run the following existing WF 3/3.5 Out of the Box activities in Workflow Services
(WF 4.0 supported in the future but not yet)
And here are the existing Workflow Services activities :
Deployment and management:
- Management portal (easy)
- Management API to automate deployment
To run on Azure, your workflows must be fully declarative, based on xaml, and this will much easier in the future with WF4; at the moment only some WF3.0/3.5 activities are currently supported and you still have to use Visual Studio 2008 + the .net service sdk.
3.New host for WF (not just for WF) : Dublin (will ship just after VS2010)
If you want to run your workflow on premises you can use your own workflow host or you can use a new one : Dublin.
- Dublin is a special Kind of IIS WAS
- Dublin is a kind of Biztalk light (now, I remember a chat with Paul Andrew, in Tech Ed 2007…)
- Dublin doesn’t replace Biztalk (which is a router between applications).
Dublin is not the host for Windows Workflow services but the Dublin team and the Workflow Service team are mutually influencing each other and work under the same leadership.
4.New language family: M
5.Oslo : focused on Modeling (creation & storing)
-an Oslo model can be defined by using a new DSL based on the M language: MSchema.
–Quadrant is a new tool that provides a common view of all models stored in an Oslo repository.
-Quadrant will mostly be used by technical Analysts/architects.
-Visual Studio will be used by developers.
6.Office 14/Sharepointx will be based on WF 3.5
Ok will be able to create real WF services in Sharepoint ( and make use of the famous Receive activity), but acording to Kenny Wowl Sharepoint/office 14 will first ship with WF 3.5 (it is currently based on WF 3.0) and will will have an upgrade to WF 4 later ; for more details, listen to what Kenny Wolf says here : PDC TL17 session after 37’45’’, and here PDC TL06 session after 68’48’’ ).
I really hope that we will be able to use WF4 in Office14 Server…One of the reason is the following picture I got from the PDC (see the Sharepoint box in the picture below)
There are indeed a bunch of new Sharepoint activities in this pictures. I’ve verified this by analyzing some assemblies provided with Visual Studio 2010 September CTP (alpha code); Reflector showed me the following Sharepoint activities in System.WorkflowModel.Activities.dll [in the namespace System.WorkflowModel.Activities namespace:]
These activities are classes derived from System.WorkflowModel.Activity which is derived from WorkflowElement (also a new kid on the block…, see picture below). WorkflowElement is now in charge of the ActivityExecutionContext (communication with the runtime, including Transaction and identity).
[Fig 11.WorkflowElement, Activity, Sharepoint activities]
7.What do you need to do next ?
- Read the Whitepaper “Workflow, Services, Models “
- Watch the following sessions online:
- WF4, First look
- WF4:Extending Workflow with Custom Activities
- Building WCF services with WF
- Dublin: Hosting and Managing Workflows And Services.
- Orchestrating Services and Business process Processes Using Cloud Based Workflow
- DynamicAX : Building Business process Into Your Application
- Declarative Programming Using XAML
- I will provide more details on WF4, WF services and Dublin in my blog (next days/weeks)
- If you are currently writing workflow code, please don’t use the Code activity anymore, but encapsulate your custom code in Custom activity with dependency properties: this will make your transition to WF4 much easier; this advice is also true for Sharepoint developers ! By the way, this was a PDC2005 good practice…