WF4 from the Inside Out

1884 days ago, 498 views
PowerPoint PPT Presentation

Presentation Transcript

Slide 1

FT04 WF4 from the Inside Out Bob Schmidt Program Manager Microsoft Corporation

Slide 2

What is this discussion about? Talk about the focal thoughts of WF, show how WF works, motivate you to test Focus is on runtime (what happens) more than programming model (how you express what you need to happen) You won't discover include records, best practices, direction You may discover thoughts, motivation, bits of knowledge

Slide 3

Where are we? Visual Studio IIS Management Activities PowerShell Application Host WF Runtime WCF Runtime Persistence Monitoring Storage Process Host

Slide 4

Ideas Programs are information (darkness begone) Scheduler-based program execution (stackless & serializable) Runtime-interceded code meet (thou shalt not hinder the string) Natural control stream (run it the way you picture it)

Slide 5

WF Programs demo

Slide 6

Authoring A WF program is a movement Can creator automatically or utilizing XAML – or in any configuration from which an action can be made An action can contain different exercises An action can have info and yield contentions (furthermore factors) Separate base classes for exercises that arrival an esteem e.g. CodeActivity<TResult>, NativeActivity <TResult> A WF program is a definition from which numerous cases can be made Each occurrence of a movement has a special domain (noticeable information values: args, vars ) InArgument esteem is acquired from environment

Slide 7

Execution WF runtime just observes exercises, exercises, exercises (not Sequence, Parallel, Recurrence) WF runtime is the official, upholds "tenets of the diversion" CacheMetadata is the means by which an action portrays itself WF runtime knows when an action is done An action can plan the execution of a kid action and be told upon its culmination There can be various, unmistakable strategy summons ("beats of work") per action Can express a wide range of examples (control stream) Multiple ways of execution…

Slide 8

Scheduler External Code Work things are executed each one in turn inside a solitary work process case Activity Code ADD WF Runtime while !EmptyList Execute(next WorkItem) while !EmptyList Execute(next WorkItem) DoBookkeeping() while !EmptyList Execute(next WorkItem) DoBookkeeping() PUSH Some work things are added to the front of the rundown, others to the back POP WorkItem 1 WorkItem 2 WorkItem 3 WorkItem 4 ENQUEUE

Slide 9

[ scheduler case ] PARALLEL SEQUENCE1 SEQUENCE2 "1" "3" "2" "4" ■ Parallel.Execute Sequence1.Execute Write("1").Execute Write("2").Execute Sequence1.Continue Parallel.Continue Write("4").Execute Sequence2.Execute Write("3").Execute Sequence2.Continue Parallel.Continue Sequence1.Continue Workflow Instance Complete! Sequence2.Execute

Slide 10

Scheduler Details Scheduler per program case Manages a requested rundown of work things Work things can be included by movement code furthermore by host & outside code Some work things are included at the front, other work things at the back Executes work things each one in turn The executing work thing is never pre-empted Things can happen between work things e.g. following, determination

Slide 11

Threading Model One string at once is utilized to process work things for a program example Simplifies the programming model for exercises Thread may vary for work things in a similar occasion WF runtime utilizes have given SynchronizationContext See System.Threading.SynchronizationContext Extensibility point for host string administration Standard TLS instruments don't make a difference to WF Instead: WF Execution Properties - named properties obvious for a section (sub-tree) of a work process Attached to/separated from the present environment by the WF runtime before/after work thing conjuring Activities ought not hinder this string WF programs arrange work

Slide 12

Asynchronous Activities demo

Slide 13

Asynchronous Activities WF Runtime Async Activity I/O code BeginExecute BeginWrite WorkItem AsyncWorkCompletionCallback WorkItem EndExecute EndWrite WorkItem

Slide 14

Parallel + async exercises = genuine simultaneousness Parallel p = new Parallel { Branches = { new WriteToFile { FileName = "a", Bytes = … }, new WriteToFile { FileName = "b", Bytes = … }; WorkflowInvoker.Invoke(p);

Slide 15

Bookmarks What happens when your projects need to hold up (and hold up, and hold up) for info? Possibly there are 1000s of occasions holding up Want a "zero impression" WaitForInput () This is a WF bookmark! A named resumption point in a WF program Resumption will plan an action's callback strategy WF runtime intercedes resumption – no requirement for the case to be in memory WCF Receive movement is based on top

Slide 16

Bookmark Resumption "Please convey [data] to case [id] at bookmark [name]" External Code Activity Code RESUME WF Runtime CREATE ENQUEUE Work thing 1 "pizza" Work thing 2 Work thing 3 Work thing 4

Slide 17

Input Activity demo

Slide 18

Persistence gives you a chance to delay an occasion, spare it some place & continue it later A persevered example has no fondness to a WF have occurrence, CLR case, string, process, or machine Helps with versatility; assists with recuperation from disappointment WF program cases are serializable A CLR stack is not serializable, but rather in a WF program a stack just exists fleetingly, amid work thing execution Sometimes you need a "no hold on zone" Automatic amid execution of an async action Details of constancy are purposely separate from the hardware of the WF runtime

Slide 19

What's in a Serialized Instance? A serialized occurrence contains: Work thing list (exhaust if case is sit without moving) Bookmarks Data (arg and var values) Environments for all executing action cases Activity case information (callbacks, execution props) Custom information from diligence members Does not contain the work process definition A million cases can have a similar definition Management of definitions is a host obligation

Slide 20

[ case: a serialized occasion ] PARALLEL private int file private int record string s DateTime d int n ■

Slide 21

[ illustration: a serialized example ] PARALLEL private int list private int list 3 string s DateTime d int n "hi" INPUT Bookmark:"x" ■

Slide 22

Conclusions WF is a method for building programs Use the right control stream & vocabulary for your circumstance Achieve genuine simultaneousness where wanted Model self-assertive hold up focuses utilizing bookmarks Utilize ingenuity as required Highly adaptable & extensible Authoring groups Custom exercises, control stream Thread administration, tirelessness, facilitating

Slide 23

Resources Ask the Experts this evening Thursday Sessions FT13: What's New in WCF 4 FT14: Workflow Services and Windows Server AppFabric FT27: Application Server Extensibility with .NET 4 and Windows Server AppFabric

Slide 24

YOUR FEEDBACK IS IMPORTANT TO US! If you don't mind round out session assessment shapes online at

Slide 25

Learn More On Channel 9 Expand your PDC encounter through Channel 9 Explore recordings, hands-on labs, test code and demos through the new Channel 9 instructional classes Built by Developers for Developers… .