340 likes | 598 Views
Workflow Services Integration of WCF and WF. PhaniKumar M T Technical Architect | BrainScale Consulting phani@brainscale.com. Session Objectives and Takeaways. Why Workflow Services? Architectural overview of Workflow Services Features Context Exchange Durable Services
E N D
Workflow ServicesIntegration of WCF and WF PhaniKumar M T Technical Architect | BrainScale Consulting phani@brainscale.com
Session Objectives and Takeaways • Why Workflow Services? • Architectural overview of Workflow Services • Features • Context Exchange • Durable Services • Duplex Workflow Services • Conversations
Agenda • A Typical Application Architecture • Architecture of WF Services • Features • Context Exchange • Durable Services • Duplex Workflow Services • Conversations • Prerequisites: • Basic Understanding of WF and WCF
Windows Workflow Foundation What is Workflow? Visual Studio Designer A Workflow Workflow is the organization of work Activity Activity Library What’s the value of Workflow? Long Running Logic Workflow Runtime Engine Flexibility Runtime Services Transparency Host Process
Workflow ServicesAdvantages • Service implemented as Workflow • Leverage Workflow development experience • Enforces application protocol by default • Allows long-running, durable Services • Workflow hosted as Service • ServiceContract provides typed interface for integrating with the Workflow • Messages enforce by-value, serializable data • Workflows can be message-activated
DEMO First Look at Workflow Services
Bindings • NetTcpContextBinding • WSHttpContextBinding • BasicHttpContextBinding • <Your Binding Here> • Create a custom binding and insert the ContextChannel into the Channel Stack
Custom Context Binding <customBinding> <binding name="namedPipeWithContext"> <context /> <binaryMessageEncoding /> <namedPipeTransport /> </binding> </customBinding>
Session Objectives and Takeaways • Why Workflow Services? • Architectural overview of Workflow Services • Features • Context Exchange • Durable Services • Duplex Messaging • Conversations
Context Exchange Architecture • ContextChannelimplemention • Receive • Extract context to ContextMessageProperty • Apply context on response to activating request • Send • Add context to all outgoing messages • Representation of context • SOAP header <wsc:Context /> • HTTP cookie • In code: IDictionary<XmlQualifiedName, string> WorkflowOperationInvoker Service Runtime DurableInstanceProvider MessageContextInspector OperationInvoker OperationSelector ContextChannel ListenerChannel InstanceProvider MessageInspector
Setting Outgoing Context • // inside wf code application • IDictionary<XmlQualifiedName, string> context; • // context = … obtain context from store • sendActivity.Context = context; • //also, to dynamically set send address • sendActivity.CustomAddress = • “net.tcp://140.141.2.5/service.svc”;
demo Context Exchange, Persistence and Management
Non WF Client Access to Context • // my wpf application • IDictionary<XmlQualifiedName, string> context; • // context = … obtain context from store • IContextManager cm = • proxy.InnerChannel.GetProperty<IContextManager>(); • if (null != cm) • cm.SetContext(context); • // need to use a channel stack which includes the • // context channel, or write the headers directly into • // the message (non-WCF) client
Session Objectives and Takeaways • Why Workflow Services? • Architectural overview of Workflow Services • Features • Context Exchange • Durable Services • Duplex Messaging • Conversations
Durable Services Architecture Persistence Provider Service.cs Service Instance Service Runtime App.config ServiceHost DurableInstanceProvider Operation 1 OperationInvoker MessageContextInspector Operation 2 OperationSelector InstanceProvider ContextChannel ListenerChannel MessageInspector DurableServiceBehavior ServiceDescription DurableOperationBehavior ServiceBehavior OperationBehavior
demo Durable Services
Session Objectives and Takeaways • Why Workflow Services? • Architectural overview of Workflow Services • Features • Context Exchange • Durable Services • Duplex Messaging • Conversations
demo Duplex Messaging
Session Objectives and Takeaways • Why Workflow Services? • Architectural overview of Workflow Services • Features • Context Exchange • Durable Services • Duplex Messaging • Conversations
Conversations • Multiple messages arriving for the same operation • Receives operating in parallel • Scenarios • Bidding • Coordinating approvals
demo Conversations
Summary • WF and WCF developers benefit from these two worlds coming together • Workflow Services provide a natural way to model services • With an understanding of context, advanced communication patterns can be implemented across many parties.
Feedback / QnA • Your Feedback is Important! Please take a few moments to fill out our online feedback. For detailed feedback, use the form at http://www.connectwithlife.co.in/vtd/helpdesk.aspx Or email us at vtd@microsoft.com • Use the Question Manager on LiveMeeting to ask your questions now!
Contact • You can visit us at: www.brainscale.com • Email Address phani@brainscale.com