mid305. appfabric / host wf runtime extensions tracking persistence … … tooling vs designer vs...

26
Building State Machine Workflows with Windows Workflow Foundation Ron Jacobs Sr. Program Manager Microsoft MID305

Upload: belinda-webb

Post on 03-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Building State Machine Workflows with Windows Workflow Foundation

Ron JacobsSr. Program ManagerMicrosoft

MID305

Page 2: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

AppFabric / Host

WF Runtime Extensions

Tracking

Persistence

Windows Workflow Foundation

Windows Workflow Foundation provides declarative authoring of programs that coordinate work

ActivitiesRuntimeTooling

Tooling

VS Designer VS DebuggerRehosted Designer

Workflow

Activity Library

Page 3: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

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 logic runs when certain conditions are met.”

Wikipedia – Finite State Machine

Page 4: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

States

Closed

Open

Open

Closed

State Transition

Page 5: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

States

Closed / Locked

Closed / UnlockedOpen

Insert Card

Open

Close

Authorized?

Page 6: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Control Flow

ControlReact

State Machine Flowchart Sequence

Which one should I use?

Page 7: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

State Machine in the real world

Load

Delivered

Picked Up

Rec

eive

d

Repair

Order

Proof Of Delivery(EPOD)

Proof Of Collection(EPOC)

Proof Of Dispatch(EPOD)

Page 8: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Security Door Requirements

Authorize Card KeysLog Door Open/Close EventsWarn Security When Door is open too long

• AuthorizeKey• DoorOpened• DoorClosed

Page 9: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

demo

Security Door

Page 10: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

how to…

Seven Steps

To State Machine Happiness

Page 11: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

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

Page 13: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Step 3: Target Framework

Web Apps / Workflow Services All Others

Page 14: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Step 4: Scenarios

Given When ThenA Closed Locked Door

An Authorized Card Key Is Read

Unlock the door

A Closed Locked Door

An Unauthorized Card Key is Read

Log the event

A Closed Unlocked Door

The Door Is Opened Log the event

An Open Door The Door Open Timeout Expires

Send an alert to security

An Open Door The Door Is Closed Log the event

Page 15: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Step 4: States / Transitions

States are destinations where you waitDoor Closed / Door OpenCreate an enum or constants to describe your states in code

Transitions are events where you respondTip: One Trigger per TransitionTriggers

Card InsertedOpen Timeout

ConditionsCard Authorized

Page 16: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Step 5: Actions

Entry / ExitDo every time you enter / exit the state

TransitionDo every time the trigger event occurs and the condition is met

Page 17: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Step 6: Tests

Get Microsoft.Activities.UnitTesting (Now via NuGet!)Create your tests as you build your scenariosStub calls to external systemsLearn to love Red / Green / Refactor

Unit Tests included in the Introduction to State Machine Hands On Lab

Page 19: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

demo

ATM State Machine

Page 20: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Related Content

Interactive SessionsWindows Workflow Foundation (WF) 4.0 in the Real World: Principles for Incorporating WF 4.0 into the Big Enterprise

Hands-on LabsIntroduction to State Machine

Product Demo StationsMiddleware & Integration booth 14

Page 22: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Resources

www.microsoft.com/teched

Sessions On-Demand & Community Microsoft Certification & Training Resources

Resources for IT Professionals Resources for Developers

www.microsoft.com/learning

http://microsoft.com/technet http://microsoft.com/msdn

Learning

http://northamerica.msteched.com

Connect. Share. Discuss.

Page 23: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Complete an evaluation on CommNet and enter to win!

Page 24: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

Scan the Tag to evaluate this session now on myTech•Ed Mobile

Page 25: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library

© 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.

Page 26: MID305. AppFabric / Host WF Runtime Extensions Tracking Persistence … … Tooling VS Designer VS Debugger Rehosted Designer Workflow Activity Library