brian noyes chief architect idesign inc () soa201

39

Upload: regina-thompson

Post on 12-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Brian Noyes Chief Architect IDesign Inc () SOA201
Page 2: Brian Noyes Chief Architect IDesign Inc () SOA201

A First Look at WCF and WF in the Microsoft .NET Framework 4.0

Brian NoyesChief ArchitectIDesign Inc (www.idesign.net) SOA201

Page 3: Brian Noyes Chief Architect IDesign Inc () SOA201

Chief ArchitectIDesign Inc. (www.idesign.net)

Microsoft Regional DirectorMVP

Microsoft MVPConnected Systems

About Brian Publishing

Developing Applications with Windows Workflow Foundation, LiveLessons training DVD, June 2007

Smart Client Deployment with ClickOnce, Addison Wesley, January 2007

Data Binding in Windows Forms 2.0, Addison Wesley, January 2006

MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side .NET, asp.netPRO, Visual Studio Magazine

Speaking

Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts

E-mail: [email protected]

Blog: http://briannoyes.net

Page 4: Brian Noyes Chief Architect IDesign Inc () SOA201

WCF & WF 4.0

Primary focus on bringing WCF + WF together

WF 4.0WCF 4.0

Simplifies developer experience

Enables new scenarios/features

Fairly minor in terms of impact to your applications

Major rewrite

Redesign of WF runtime and programming model

Need to relearn new approach

Page 5: Brian Noyes Chief Architect IDesign Inc () SOA201

WCF 4.0 Features

Page 6: Brian Noyes Chief Architect IDesign Inc () SOA201

New WCF 4.0 Features

Simplified configurationDiscoveryRouter serviceImproved REST supportMisc. advanced features

Page 7: Brian Noyes Chief Architect IDesign Inc () SOA201

Simplified Configuration

New support for default service configurationsDefault binding & behavior configurationsImplicit endpoint configurations

Much easier to get services up and runningRemoves the need for <service> configurationAlso enables file-less activation (no .svc)

Need to use with careImplicit anything can be a maintenance and debugging nightmare

Page 8: Brian Noyes Chief Architect IDesign Inc () SOA201

Service Discovery

WCF 4.0 provides two types of service discovery

Clients can discover services on a local subnet (UDP-based)

Clients can discover services on a larger "managed" network (beyond the local subnet) through a discovery proxy

Adhoc Managed

Enabled via the serviceDiscovery behavior,clients "discover" services using a DynamicEndpoint

Page 9: Brian Noyes Chief Architect IDesign Inc () SOA201

New WCF 4.0 Features – Part Idemo

Page 10: Brian Noyes Chief Architect IDesign Inc () SOA201

Router Service

First-class "router" serviceContent-based routing, protocol bridging, etcError handling support

You host it like any other WCF serviceConfigure with routing "filters"

Client

Service

Service

Router

"filters"

Page 11: Brian Noyes Chief Architect IDesign Inc () SOA201

Improved REST Support

Many features from the WCF REST Starter Kit will become part of WCF 4.0

Automatic help page HTTP caching support

?

Page 12: Brian Noyes Chief Architect IDesign Inc () SOA201

New WCF 4.0 Features – Part IIdemo

Page 13: Brian Noyes Chief Architect IDesign Inc () SOA201

Advanced WCF Features

DataContractResolver for type resolutionAllows you to override known type resolution

Support for queues with competing consumersAdded a "receive context" feature

High-performance ETW-based tracingBlob encoder

Page 14: Brian Noyes Chief Architect IDesign Inc () SOA201

WF 4.0 features

Page 15: Brian Noyes Chief Architect IDesign Inc () SOA201

WF 3.x Challenges Today

Limited support for XAML-only workflowsVersioning is problematicLimited base activity libraryWriting custom activities is hardManaging data flow is really hardDesigner is annoying and difficult to rehostRules engine is primitive and not extensible

Page 16: Brian Noyes Chief Architect IDesign Inc () SOA201

Moving Towards WF 4.0

Major themes in WF 4.0 include…

Declarative workflow model

(XAML only)

Enhanced baseactivity library

Simplifying custom

activities

Simplifyingdata flow

Runtime improvements

Designerimprovements

Page 17: Brian Noyes Chief Architect IDesign Inc () SOA201

XAML-only Workflows

A declarative workflow is fully described within a XAML file (no code-behind)

Has always been the ultimate WF visionPossible in .NET 3.x but not easy

.NET 4.0 makes them first-class citizensEnhancements to programming model remove the need for code-behind files altogetherFull designer support in Visual Studio 2010

Page 18: Brian Noyes Chief Architect IDesign Inc () SOA201

Benefits of Declarative Workflows

C#DSL

Visio

Increases hosting & deployment flexibility

It can be represented in different formatsXAML, C#, Visio, custom DSL, etc.

The program definition is just dataIt's typically an XML file that's easy to processSimplifies tool support and designersIt can be stored anywhere (file, DB, cloud, etc.)

Page 19: Brian Noyes Chief Architect IDesign Inc () SOA201

Extended Base Activity Library

.NET 4.0 comes with several new/enhanced activities

Flowchart

ForEach

Parallel*

ParallelForEach*

DoWhile

Pick

AddToCollection

RemoveFromCollection

ExistsInCollection

ClearCollection

...

Assign

InvokeMethod

Persist

TryCatch

CompensableActivity

Interop

...

Flow Control Collection Others

Microsoft is planning to ship more activities via CodePlex over time* New "parallel" behavior

Page 20: Brian Noyes Chief Architect IDesign Inc () SOA201

New Flow Chart Model

Simple step-by-step model, with decisions and switches

Allows you to return to previousactivities in the workflow

Flowcharts offer a middle ground between the sequential and state machine models

Page 21: Brian Noyes Chief Architect IDesign Inc () SOA201

Simplified WF Programming Model

WF 4.0 makes it much easier to:Host workflows and run workflow instancesManage workflow bookmarksCreate custom activitiesPass data into activities and store dataUnit test activities and workflowsUse activities outside of workflows

Rules engine

Page 22: Brian Noyes Chief Architect IDesign Inc () SOA201

WorkflowElement

Activity CodeActivity NativeActivity

Creating Custom Activities

New Programming Model for Custom Activities

Plus the new DynamicActivity for dynamic activity composition

Page 23: Brian Noyes Chief Architect IDesign Inc () SOA201

WF 4.0 Data Flow Constructs

Arguments

Variables

Expressions

Used to define the way data flows in and out of an activity; each argument has a binding direction: input, output, or input/output.

Used to declare named storage for data within an activity; variables can be defined at different scopes within a workflow.

Takes one or more input arguments, performs some operation on those input arguments, and then returns a value.

Page 24: Brian Noyes Chief Architect IDesign Inc () SOA201

Arguments and Variables

Flow Chart

Parallel

Sequence

SendMessage

Delay ReceiveMessage

GenerateOrder

InArgument<TimeSpan>

OutArgument<Order>

InArgument<Message>

OutArgument<Message>

ProcessOrder

SendReport

Variables

Variables

Variables

Activities are the primitive abstraction for behaviorActivities define Arguments to declare the type of data that can flow into or out of an ActivityActivities are composable with other ActivitiesActivities have user-defined Variables for data storageActivities bind Arguments to in-scope Variables

Page 25: Brian Noyes Chief Architect IDesign Inc () SOA201

WF 4.0 Programming Modeldemo

Page 26: Brian Noyes Chief Architect IDesign Inc () SOA201

WCF + WF 4.0:Workflow Services

Page 27: Brian Noyes Chief Architect IDesign Inc () SOA201

WCF Workflow ServicesWCF Service

WF Workflow

ClientExternalService

ExternalService

WCF endpoint

WCF endpoint

Page 28: Brian Noyes Chief Architect IDesign Inc () SOA201

Workflow Services

New messaging activitiesAdd service reference (Visual Studio)XAML authoring (contracts, bindings, etc)Workflow service host

Page 29: Brian Noyes Chief Architect IDesign Inc () SOA201

WCF Activities in .NET 4.0

WF 4.0 comes with new-and-improved WCF activities

Send

Receive

SendAndReceiveReply

ReceiveAndSendReply

Send

Receive

.NET 4.0.NET 3.5

All 4.0 messaging activities come with improvedWCF support including correlation

Page 30: Brian Noyes Chief Architect IDesign Inc () SOA201

Message Correlation

When sending and receiving WCF messages, correlation is a common need

.NET 4.0 adds correlation support to WCFWF makes correlation easy to use via activities

Page 31: Brian Noyes Chief Architect IDesign Inc () SOA201

Workflow Servicesdemo

Page 32: Brian Noyes Chief Architect IDesign Inc () SOA201

The New WF Designer

Improved UsabilityImproved Designer Performance

Major Rehosting Improvements

Unified Debugging Experience

Page 33: Brian Noyes Chief Architect IDesign Inc () SOA201

WF Runtime Improvements

Full Control Over Persistence

10-100x Performance Improvements

Flow-in Transactions

Page 34: Brian Noyes Chief Architect IDesign Inc () SOA201

Preparing for WF 4.0

Your 3.x workflows will continue to workUsing the WF 3.5 runtime and framework classes

You can use 3.x activities in a 4.0 workflowUse the Interop activity to wrap them

Avoid code activities and handling activity events in code behindMore guidance coming from Microsoft…

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bd94c260-b5e0-4d12-93ec-53567505e685#filelist

Page 35: Brian Noyes Chief Architect IDesign Inc () SOA201

Summary

WCF/WF 4.0 offers many improvements:WCF + WF integration: Workflow ServicesNew WCF features & messaging improvementsNew WF runtime, programming model, & designer

Lays a solid foundation for building connected systems on the .NET platform

Page 36: Brian Noyes Chief Architect IDesign Inc () SOA201

Additional Resources

IDesign WF 4 Master ClassWCF and WF Services in the .NET Framework 4.0 and "Dublin"

http://msdn.microsoft.com/en-us/magazine/2009.01.net40.aspx

The Workflow Way (new whitepaper)http://msdn.microsoft.com/wf/future

Page 37: Brian Noyes Chief Architect IDesign Inc () SOA201

Question & Answer

Page 38: Brian Noyes Chief Architect IDesign Inc () SOA201

Complete a session evaluation and enter to win!

10 pairs of MP3 sunglasses to be won

Page 39: Brian Noyes Chief Architect IDesign Inc () SOA201

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