2302d41cf373504ed0eb5f4a354ebd74.ppt
- Количество слайдов: 63
Biz. Talk Server 2006 10 Most Useful Orchestration Patterns Charles Young Principal Consultant Copyright Solidsoft 2007
Top 6 Questions that kept me awake. . . n n n Do I have 10 patterns? Who says they are the most useful? What if I only have 6 patterns? What if I have 60 patterns? What about anti-patterns? Surely not another seminar on convoys and scatter-gatherer. . . Copyright Solidsoft 2007
Agenda n n n What are orchestrations, anyway? Convoying – of course! Common techniques for hard problems Mapping models to implementation Dynamic approaches Building the Service Bus Copyright Solidsoft 2007
What is a Pattern? n A normative example. . . • . . . worthy of imitation • . . . used as a guide, model or prototype of a design we plan to implement Copyright Solidsoft 2007
What is an Orchestration? n “The automated arrangement, coordination, and management of complex computer systems, middleware, and services” • Wikipedia (fount of all knowledge and truth) n “A type of collaboration in which a primary service directly invokes other services” Copyright Solidsoft 2007
Isn’t this just Enterprise Integration Patterns? n n n http: //www. eaipatterns. com/ NO! Content-Based Router Message Filter Dynamic Router Recipient List Splitter Aggregator Resequencer Composed Msg. Processor Scatter-Gather Routing Slip Process Manager Message Broker . . . if I hear "Scatter-Gatherer“ one more time. . . Copyright Solidsoft 2007
Are you sure? n n n Well, orchestrations implement messagebased integration patterns… …but the have a more fundamental purpose: They: • Coordinate • Synchronise • Manage Copyright Solidsoft 2007
An old debate. . . n n n What’s the difference between orchestration and choreography? Some say they are synonyms Some say they are antonyms • centralised control vs. distributed collaboration • process vs. protocol Copyright Solidsoft 2007
A self-evident truth. . . n The term… ‘orchestration’. . . is not as cool as the term ‘choreography’ Copyright Solidsoft 2007
Orchestration. . . n A constrained viewpoint • • n Discrete Centralised Process-orientated Imperative Conceptual model maps directly to controller processes/workflows Copyright Solidsoft 2007
Choreography. . . n An expansive viewpoint • • n Multi-agent Distributed Protocol-orientated Collaborative Conceptual model maps directly to decoupled interaction between autonomous agents/services Copyright Solidsoft 2007
Orchestration Û Choreography! n n Orchestrations control interaction between services. . . but orchestrations are services too! You can choreograph your orchestrations You can orchestrate the parts of your choreography Copyright Solidsoft 2007
So what is an Orchestration? n A style or type of service • Process controller/manager services n A specific technology operating in a specific context • The Biz. Talk Message Box • Correlation, transactions, compensation, etc. Copyright Solidsoft 2007
Why not use web services? n Once, it was easy to decide • No WCF / WF n Orchestrations: • • • Are service-orientated & message based Are scalable & multi-threaded Support advanced features Are administered from a single point Are created through model-driven development Copyright Solidsoft 2007
The #1 Differentiator n n It’s the Message Box, stupid! “Does the service need to communicate with other services & systems across a set of scalable, asynchronous, persisted message queues? ” Yes or No Copyright Solidsoft 2007
Biz. Talk Server vs. ‘Dublin’ n The great debate • ‘Dublin’ is free(? ), BTS is not • ‘Dublin’ looks and feels like BTS n But consider. . . • ‘Dublin’ and BTS are service-orientated • BTS is also message-orientated n n Messages are first-class citizens, even in orchestrations It’s the Message Box, stupid! Copyright Solidsoft 2007
Microsoft’s shorthand. . . n ‘Dublin’: - ‘Application server’ n BTS: - ‘Integration server’ • “hosts … business logic and business processes for use by … applications” (Wikipedia, again) • The service is king • Facilitates interaction between diverse systems, technologies and protocols across internal and external networks • The message is king Copyright Solidsoft 2007
What’s the Top 1 Anti-Pattern? n In a WCF / WF / Dublin world. . . • Using orchestration where the Message Box isn’t needed • Architecture should promote synergy between Biz. Talk Server and WCF / WF n More about this later Copyright Solidsoft 2007
. . . And the Top 1 Pattern? n You’ve guessed it! • Using orchestration where the Message Box IS needed • Architecture should promote synergy between Biz. Talk Server and WCF / WF Copyright Solidsoft 2007
Is this a good Orchestration Pattern? Copyright Solidsoft 2007
CONVOYS Copyright Solidsoft 2007
Convoying n The best-known orchestration patterns • http: //msdn. microsoft. com/en-us/library/ms 942189. aspx • Used when messages are logically grouped into ‘streams’ or ‘sets’ n Two dimensions: • Uniformity n are the messages all of the same type? • Sequentiality n Do the messages flow as a ‘stream’ Copyright Solidsoft 2007
Four Core Orchestration Patterns Sequential Uniform Non-Uniform þ þ Parallel þ þ Copyright Solidsoft 2007
Uniform Sequential Start Msg 1 Msg 2 Msg 3 Msg 4 End Msg 5 n n Use loops to simplify pattern Most common convoy Beware Zombies! same Arbitrary-sized convoys type All messages share Messages may be in-flight when • Detecting convoy ends single Orchestration port has Delay triggers operation • Using timers n Copyright Solidsoft 2007
Non-Uniform Sequential Start Msg 1 Msg 2 Msg 3 Msg 4 End Msg 5 n Messages have not needed Loops generally different types • Different message types • must be received in the has Single orchestration port correct order multiple operations Copyright Solidsoft 2007
Non-sequential Concerns n n What if the convoy can be optionally started by more than one message? What if the convoy messages arrive out of order? Copyright Solidsoft 2007
Parallel Start Msg 1 Msg 2 Msg 3 End n Any message may Uniform Parallel start the convoy common convoy pattern • Least Set all Receive shapes to • Occasionally useful when using ‘Activate’ subscription rules different for same message types Copyright Solidsoft 2007
Convoying n Which is more fundamental in BTS? • Correlation or Convoying? n Trick question! • Convoying is the most fundamental correlation mechanism BTS offers • Convoying is a fundamental MEP • It’s a Message Box / subscription thing n Orchestrations play a supporting role Copyright Solidsoft 2007
Convoying n ‘Activate’ subscription • Stored in the subscription table • Can be ‘parameterised’ for ‘convoy sets’ n Convoy Sets • Correlation sets in the subscription system • Match a maximum of three promoted properties • Represented by Correlation Sets in orchestrations n One-time only delivery generally needed • Beware Zombies! n Ordered delivery often needed Copyright Solidsoft 2007
DECOMPOSE FOR COMPLEX CORRELATION Copyright Solidsoft 2007
Consider the following. . n n What happens when you try to build? Error: a correlation may be initialized only once Copyright Solidsoft 2007
Basic Rule n If it won’t compile, decompose • Break out into separate orchestrations Copyright Solidsoft 2007
UNDERSTANDING CORRELATION SETS Copyright Solidsoft 2007
Correlation Sets. . . n . . . do three things • Store a set of property values for later use • Create subscription rule conditions on Receive shapes • Promote properties on Send shapes n n Subscription only uses promoted properties Sometimes, you don’t use the stored values • That’s OK! Copyright Solidsoft 2007
Correlation Sets and Direct Binding n If you understand Correlation Sets. . . • remember decomposition n n . . . and if you use direct, Message Box, binding. . . You can implement (almost) any interchange pattern you want! • More on this later Copyright Solidsoft 2007
SELF-TARGETED ORCHESTRATIONS Copyright Solidsoft 2007
Why, oh why. . . n Biz. Talk Server has inbuilt support for non-deterministic control messages • Used when you don’t know if the target recipient is listening • If a control message is not delivered, it is quietly discarded • E. g. , Acks and Nacks n But you can’t create your own control messages!!! Copyright Solidsoft 2007
Where would I use such messages? n Event-driven control of long-running processes • Events occur non-deterministically • Events need to be correlated onto specific orchestration instances IF they are still running Copyright Solidsoft 2007
One obvious approach. . . n Add event consumer orchestrations • Always consume event messages, regardless of running orchestrations • Subscribe by general type – don’t use correlation • Optionally use never-ending uniform sequential convoy loop to optimise performance Copyright Solidsoft 2007
A more elegant approach. . . n n n Init a CS on Activate Receive Init a second CS of the same type on Send_1 Follow first CS on ‘Receive Event’ Uses Convoy One-shot event emitter Copyright Solidsoft 2007
. . . with looping. . . Copyright Solidsoft 2007
The takeaway. . . n When handing non-deterministic, correlated event and control messages, passing those messages between different branches of a parallel shape will often get you out of trouble. Copyright Solidsoft 2007
MASTER / SLAVE Copyright Solidsoft 2007
Orchestrating your orchestrations. . . n n n Remember, orchestrations are services as well. Composition and aggregation. . . Re-use. . . Master Slave 2 Re-usable Orchestration Slave 1 Slave 3 Copyright Solidsoft 2007
Mapping logical design to physical implementation High-level Design Detailed Logical Design Physical Design Master Detailed Logical Design Physical Design Slave 1 Slave 3 Slave 2 Slave 4 Copyright Solidsoft 2007
Traceability Copyright Solidsoft 2007
Orchestration invocation n Call Orchestration • • n No Message. Box invocation A stronger form of scoping ‘out’ parameters Limited to same host Start Orchestration • Asynchronous via message box • Internal ‘RPC’ messages Copyright Solidsoft 2007
Orchestration invocation n ‘Direct Binding’ • Message Box – i. e. , ‘do it yourself’ n Remember correlation sets • Partner ports • Self-correlating ports Copyright Solidsoft 2007
DYNAMIC PATTERNS Copyright Solidsoft 2007
Dynamic Biz. Talk – the unknown country n Static Biz. Talk configuration • Routing n n • • • Subscription rules Bindings Addresses Adapter selection Transformation Retry policy Service Windows Etc. , etc. , Copyright Solidsoft 2007
Dynamic Features n n n Dynamic Send Ports Inbound / outbound port mapping XML Message Type resolution • XMLReceive Pipeline n BAM Interception n XLANG/s Transform Copyright Solidsoft 2007
Real-world challenges n n I need to change the composition of by business processes rapidly (e. g. , to support new campaigns, deal with supplier churn, etc. I need to be able to change and version parts of my process orthogonally to other parts, within the context of longrunning activities, without disruption. Copyright Solidsoft 2007
What we need. . . n n n Agile orchestration composition Fine-grained orchestration versioning Policy-driven mediation and routing • Endpoint resolution • Transformation • Tracking n . . . or more precisely. . . we need the tooling to make this easy Copyright Solidsoft 2007
Dynamic Biz. Talk n Enabled through intermediate components • • • Resolution components (ESB Guidance Toolkit) BAM interceptors (built-in) Rules Engine (with vocabularies) Consumer Resolver Provider Policies Copyright Solidsoft 2007
Agile Versioning Long–Running Activities Process 1 Orch 1 Tax Calc v 1 Orch 2 Tax Calc v 1 Process 2 Orch 2 Copyright Solidsoft 2007
Agile Composition Master Orchestration Order stock from contoso. com Calculate Local Taxes Shedule Contrator 1 Order stock from northwind. com Calculate new Local Taxes Shedule Contrator 2 Mail brochure for Campaign A Mail brochure for Campaign B Copyright Solidsoft 2007
MOVING ON TO SERVICE BUSES Copyright Solidsoft 2007
Building the Service Bus n n Common service interaction ‘fabric’ Distributed architecture Centralised administration Platform and technology agnostic • Standards • Adapters and bridges n Dynamic configuration and deployment Copyright Solidsoft 2007
Biz. Talk Server 2006 – Service Bus Receive Locations Adapters ‘On-Ramp’ Services Pipelines Maps Subscription ‘Off-Ramp’ & Relay Services Maps Subscription Orchestration Services Copyright Solidsoft 2007
Using Biz. Talk Server with WCF n n Technology ‘segments’ Common transports • WCF bindings n Service directory • Resolution • Policies and administration n Dynamic messaging Copyright Solidsoft 2007
Biz. Talk Server and WCF / WF Copyright Solidsoft 2007
Summary n n n What are orchestrations? Convoying & Correlation Handling Events Mapping to Logical Models Implementing Dynamic Patterns Building the Service Bus Copyright Solidsoft 2007
Delivering Service-Orientated Solutions on the Microsoft Platform Thank you Copyright Solidsoft 2007
2302d41cf373504ed0eb5f4a354ebd74.ppt