260 likes | 639 Views
MID305. Building State Machine Workflows with Windows Workflow Foundation . Ron Jacobs Sr. Program Manager Microsoft. Windows Workflow Foundation. Tooling. VS Designer. VS Debugger. Rehosted Designer. AppFabric / Host.
E N D
MID305 Building State Machine Workflows with Windows Workflow Foundation Ron Jacobs Sr. Program Manager Microsoft
Windows Workflow Foundation Tooling VS Designer VS Debugger Rehosted Designer AppFabric / Host • Windows Workflow Foundation provides declarative authoring of programs that coordinate work • Activities • Runtime • Tooling Workflow Activity Library WF Runtime Extensions Persistence Tracking …
State Machine “It is a behavior model composed of a finite number of states, transitions between those states, and actions, similar to a flow graph in which one can inspect the way logicruns when certain conditions are met.” Wikipedia – Finite State Machine
States State Transition
States Insert Card Close Authorized? Open
Control Flow Which one should I use? Control React Flowchart Sequence State Machine
State Machine in the real world Proof Of Dispatch (EPOD) Repair Load Order Received Proof Of Collection (EPOC) Proof Of Delivery (EPOD) Delivered Picked Up
Security Door Requirements • Authorize Card Keys • Log Door Open/Close Events • Warn Security When Door is open too long • AuthorizeKey • DoorOpened • DoorClosed
Security Door demo
Seven Steps To State Machine Happiness how to…
Step 1: .NET Platform Update 1 • Microsoft .NET Framework 4 Platform Update 1 – Design-time Package for Visual Studio 2010 SP1 (KB2495593) • Installs the everything and configures Visual Studio. • Microsoft .NET Framework 4 Platform Update 1 (KB2478063) • Contains the runtime files for the platform update. • Use for production environments
Step 2: Hands On Lab • Introduction to State Machine Hands On Lab
Step 3: Target Framework Web Apps / Workflow Services All Others
Step 4: States / Transitions • States are destinations where you wait • Door Closed / Door Open • Create an enum or constants to describe your states in code • Transitions are events where you respond • Tip: One Trigger per Transition • Triggers • Card Inserted • Open Timeout • Conditions • Card Authorized
Step 5: Actions • Entry / Exit • Do every time you enter / exit the state • Transition • Do every time the trigger event occurs and the condition is met
Step 6: Tests • Get Microsoft.Activities.UnitTesting (Now via NuGet!) • Create your tests as you build your scenarios • Stub calls to external systems • Learn to love Red / Green / Refactor Unit Tests included in the Introduction to State Machine Hands On Lab
Step 7: Follow • Blogs • appfabric.tv • AppFabric • Ron Jacobs • Twitter • @appfabric • @ronljacobs • Facebook • Appfabric • Ron Jacobs
ATM State Machine demo
Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification Exam that relate to your session. Also indicate when they can find you staffing in the TLC. Related Content • Interactive Sessions • Windows Workflow Foundation (WF) 4.0 in the Real World: Principles for Incorporating WF 4.0 into the Big Enterprise • Hands-on Labs • Introduction to State Machine • Product Demo Stations • Middleware & Integration booth 14
Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • Windows Azure Platform Training Kit • Windows Server AppFabric Training Kit • BizTalk 2010 Developer Training Kit • AppFabric Team Blog • Windows Azure AppFabric on MSDN • Windows Server AppFabric on MSDN
Resources • Connect. Share. Discuss. http://northamerica.msteched.com Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers http://microsoft.com/technet http://microsoft.com/msdn
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.