Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction...
Transcript of Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction...
![Page 1: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/1.jpg)
Dancers interact with one another with no overall concept of direction. "There is no conductor."Orchestration: assumes there is a central "conductor" who runs all processes. Choreography: describes a transaction without the assumption of central control.
Choreography
ChoreographyMonday, April 05, 201010:46 AM
Choreography Page 1
![Page 2: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/2.jpg)
In BPMN and BPEL, subprocesses only exist inside individual business entities. A choreography is a kind of subroutine that encompasses multiple entities. It is more like a "dance" than a "procedure", in the sense that all entities "participate".
Understanding choreography
Understanding choreographyMonday, April 05, 20101:32 PM
Choreography Page 2
![Page 3: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/3.jpg)
A WSDL description describes how to call a service, but not in what order!A choreography describes the order in which to make various calls to a service to complete a transaction... …without proscribing the global order of alltransactions (as in BPEL).
Need for choreography
Need for choreographyMonday, April 05, 201010:48 AM
Choreography Page 3
![Page 4: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/4.jpg)
Two participants: user and SIS
User requests SIS page. SIS prints page on browser.
User enters Login name and Password and presses "login".
In this case, the dance "ends" successfully.
succeeds if correct.
In this case, user presses "back" and "refresh" and tries again.
prints an error message and fails if the form is too old.
In this case, user ends session and tries later.
prints an error message if SIS is unavailable.
In this case, user presses "back" and "refresh" and tries again.
prints an error message if the password and login don't match.
SIS checks Login name and Password and
Repeat until success:
End repeat.
Dance steps:
Example: login to SIS
Involves multiple entities This example:
Example: login to SISMonday, April 05, 20101:40 PM
Choreography Page 4
![Page 5: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/5.jpg)
Involves multiple entities Has multiple failure conditions. Results in a predictable state if successful.
Choreography Page 5
![Page 6: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/6.jpg)
choreography: a set of instructions whereby multiple entities interact.participant: an interacting entity within a choreography. role: the type of a participant, expressed as an interface.interaction: a series of steps in which two participants interact, can contain an exchange, sequence, parallel, or workunit. exchange: a step at which data passes between participants.sequence: a sequence of exchanges or other actions, that occur in order. parallel: a set of exchanges that all happen at once. workunit: a repeated conditional set of exchanges, can contain exchange, sequence, parallel or other workunit. Can emulate if, while, wait until, and repeat until constructions. choice: a set of alternatives, one of which happens.assign: assign a value to a variable.
Choreography concepts
Choreography conceptsMonday, April 05, 20101:45 PM
Choreography Page 6
![Page 7: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/7.jpg)
Two participants: user and SIS
<exchange>User requests SIS page.</exchange><exchange>SIS prints page on browser.</exchange><exchange>User enters Login name and Password and presses "login". </exchange>
<exchange> SIS prints an error message and fails if the form is too old. </exchange> <exchange> SIS prints an error message if SIS is unavailable. </exchange> <exchange> SIS prints an error message if the password and login don't match. </exchange><exchange> SIS checks Login name and Password and succeeds if correct. </exchange>
<choice>
</choice>
<sequence>
</sequence>
<workunit>Repeat until success:
</workunit>
<interaction>
</interaction>
Example: login to SIS
Example: login to SISMonday, April 05, 20101:40 PM
Choreography Page 7
![Page 8: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/8.jpg)
<relationship type='…'/> <variableDefinitions> …</variableDefinitions> … sequence, parallel, interaction, workunit, …
<choreography>
</choreography>
Outline of a choreography
True form of a choreographyMonday, April 05, 20102:26 PM
Choreography Page 8
![Page 9: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/9.jpg)
Describe interactions/precedences. "Like an arrow" in a BPEL or BPMN diagram.
Relationships
Buyer Seller Relationship
<description type="documentation">
</description>
<roleType typeRef="tns:BuyerRole"/>
<roleType typeRef="tns:SellerRole"/
<relationshipType name="Buyer2Seller">
</relationshipType>
...
<relationship type="tns:Buyer2Seller"/>
<choreography …>
</choreography>
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
RelationshipsMonday, April 05, 201011:08 AM
Choreography Page 9
![Page 10: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/10.jpg)
A choreography is a description of coordinated state.Can accumulate state on each side of a transaction.State is represented via state variables. These are defined outside the choreography.
Binding and state
Binding and stateMonday, April 05, 20102:31 PM
Choreography Page 10
![Page 11: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/11.jpg)
A choreography is contained inside a package.
informationType declarations. variable declarations. token declarations. tokenLocator declarations. roleType declarations. The choreography.
Package contains
A package is a declaration scope: declarations don't cross packages.
Packages
PackagesMonday, April 05, 20102:32 PM
Choreography Page 11
![Page 12: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/12.jpg)
A role describes one side of a set of exchanges. A roleType describes what that side should be capable of doing, e.g., its interface.
Roles and roleTypes
Example:
Role for Seller
<description type="documentation">
</description>
interface="SellerBehaviorInterface">
Behavior for Seller
<description type="documentation">
</description>
<behavior name="SellerBehavior"
</behavior>
<roleType name="SellerRole">
</roleType>
...
Seller Participant
<description type="documentation">
</description>
<roleType typeRef="tns:SellerRole"/
<participantType name="Seller">
</participantType>
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
SellerBehaviorInterface is defined via WSDL, e.g., the capabilities of the "SellerBehaviorInterface".
Normally,
Roles and roleTypesMonday, April 05, 20103:11 PM
Choreography Page 12
![Page 13: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/13.jpg)
A variable is something that can be set through the assign action. A token is a read-only part of a message. A tokenLocator describes an algorithm for fetching a token.
Variables, tokens, and locators
Variables, tokens, and locatorsMonday, April 05, 20102:39 PM
Choreography Page 13
![Page 14: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/14.jpg)
A declaration of the kind of information in an exchange. OFten defined through WSDL.Accessed via "tokens". Example:
InformationType
type="primer:QuoteRequestType">
Quote Request Message
<description type="documentation">
</description>
<informationType name="QuoteRequestType"
</informationType>
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
QuoteRequestType: a local typename. primer:QuoteRequestType: a WSDL Xschema type.
InformationTypeMonday, April 05, 20102:45 PM
Choreography Page 14
![Page 15: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/15.jpg)
A token is a part of a message or variable. Read-only. Might be the same for different kinds of messages.
Tokens and tokenLocators
Example:
Identity token
<description type="documentation">
</description>
<token name="id" informationType="tns:IdentityType"
</token>
...
informationType="tns:QuoteRequestType"
query="/quote/@id">
Identity for QuoteRequestType
<description type="documentation">
</description>
<tokenLocator tokenName="tns:id"
</tokenLocator>
tns: the nameSpace; our namespace for the example. tns:id: our token called "id". tns:QuoteRequestType: the type of data in which it lives. /quote/@id: an XPATH determining the location of the token (in the id attribute of the quote XML element).
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
Tokens and tokenLocatorsMonday, April 05, 20102:41 PM
Choreography Page 15
![Page 16: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/16.jpg)
During a sequence, one can assign a value to a variable. Variable assignment
Boolean type for use in loop control
<description type="documentation">
</description>
<informationType name="Boolean" type="xsd:boolean"
</informationType>
...
informationType="tns:Boolean"
roleTypes="tns:SellerRole">
Variable used to control loop exit.
<description type="documentation">
</description>
<variable name="barteringDone"
</variable>
<variableDefinitions>
</variableDefinitions>
...
Initialise Loop Variable
<description type="documentation">
Set barteringDone to false
<description type="documentation">
</description>
<source expression="false()"/>
<target
variable="cdl:getVariable('barteringDone','','')"/>
</description>
<copy name="setBarteringDone">
</copy>
<assign roleType="tns:SellerRole">
</assign>
Example:
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
Variable assignmentMonday, April 05, 20102:55 PM
Choreography Page 16
![Page 17: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/17.jpg)
sequence: a serial stream of exchanges, etc.parallel: a parallel stream. choice: select one of several options.workunit: if/while/repeat…until.
Four kinds of sequencing
SequencingMonday, April 05, 20102:53 PM
Choreography Page 17
![Page 18: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/18.jpg)
Encompasses several kinds of conditional executionExample: <workunit guard='G' block='B' repeat='R'>…</workunit>
workunit
…actions...<workunit guard='expression' block='false()'>
</workunit>
"If" statement
…actions…<workunit guard='expression' block='true()'>
</workunit>
"wait until" statement
…actions…<workunit guard='true()' repeat='expression'>
</workunit>
"repeat...until" statement:
… actions…
<workunit guard='expr1' repeat='expr2' block='true()'>
"wait, then repeat"
Uses
workunitMonday, April 05, 20103:20 PM
Choreography Page 18
![Page 19: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/19.jpg)
… actions…block='true()'>
</workunit>
Choreography Page 19
![Page 20: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/20.jpg)
Blocking
Workunit (G) (R) (B is True)Body
WhereG => guard conditionR => repeat conditionB => blocking attributeBody => CDL activities within the work unit
A typical order of evaluation is as follows:
(G) Body (R G) Body (R G) Body
With respect to a G then the G is only evaluated when the variables are available and evaluate to True and otherwise we wait at the guard condition. Thus the Body after the first G only gets executed when G is True. Or put another way Body is primed ready for action and then is executed when G evaluates to True.
IF G is unavailable or evaluates to False THEN it equates to:
when (G) {Body
} until (!R)
IF G is always True THEN it equates to:
repeat {Body
} until (!R)
IF R is always False THEN it equates to:
when (G) {Body
Workunit optionsMonday, April 05, 201011:09 AM
Choreography Page 20
![Page 21: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/21.jpg)
Body}
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
Choreography Page 21
![Page 22: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/22.jpg)
A variable corresponding to communication between roles.
Buyer to Seller Channel Type
<description type="documentation">
</description>
<roleType typeRef="tns:SellerRole"/>
<token name="tns:URI"/>
<reference>
</reference>
<token name="tns:id"/>
<identity type="primary">
</identity>
<channelType name="Buyer2SellerChannel">
</channelType>
...
<variable name="Buyer2SellerC"
Channel Variable
<description type="documentation">
</description>
channelType="tns:Buyer2SellerChannel"
roleTypes="tns:BuyerRole tns:SellerRole"
</variable>
...
operation="getQuote"
channelVariable="tns:Buyer2SellerC">
...
<interaction name="QuoteElicitation"
</interaction>
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/>
Channel
ChannelsMonday, April 05, 20103:27 PM
Choreography Page 22
![Page 23: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/23.jpg)
<interaction name="QuoteElicitation"
operation="getQuote"
channelVariable="tns:Buyer2SellerC">
<description type="documentation"> Quote Elicitation</description>
<participate relationshipType="tns:Buyer2Seller"
fromRoleTypeRef="tns:BuyerRole"
toRoleTypeRef="tns:SellerRole"/>
<exchange name="QuoteRequest"
informationType="tns:QuoteRequestType"
Quote Request Message Exchange
<description type="documentation">
</description>
<send variable="cdl:getVariable('quoteRequest','','')"/>
<receive variable="cdl:getVariable('quoteRequest','','')"/
</exchange>
<exchange name="QuoteResponse"
<choose>
action="request">
informationType="tns:QuoteResponseType"
Quote Response Message Exchange
<description type="documentation">
</description>
<send variable="cdl:getVariable('quoteResponse','','')"/>
<receive variable="cdl:getVariable('quoteResponse','','')"/
</exchange>
<exchange name="QuoteResponseFault"
action="respond">
informationType="tns:QuoteResponseFaultType"
action="respond"
Quote Response Fault Exchange
<description type="documentation">
</description>
<send variable="cdl:getVariable('faultResponse','','')"/>
<receive variable="cdl:getVariable('faultResponse','','')"/
</exchange>
</choose>
faultName="InvalidProductFault">
</interaction>
Pasted from <http://www.w3.org/TR/ws-cdl-10-primer/> and edited (a bit).
Choreography example
Choreography exampleMonday, April 05, 201010:49 AM
Choreography Page 23
![Page 24: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/24.jpg)
Transaction diagramMonday, April 05, 20106:53 PM
Choreography Page 24
![Page 25: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/25.jpg)
Choreographies have participants, whose behavior is specified by roleTypes, in terms of interfaces, which are defined (optionally) via WSDL. Communication is described via channel variables, which have channelTypes, which are defined by specifying tokens to extract, via tokenLocatordeclarations. State is represented by variables, which are defined through variableDeclarations, where types are XSchemas, and assign controls their values. Program flow is represented by sequences, parallelexecution, choice, and workunits, which emulate common control methods.
Putting WS-CDL together
Putting WS-CDL togetherMonday, April 05, 20104:51 PM
Choreography Page 25
![Page 26: Orchestration Choreography: describes a transaction ... · Choreography: describes a transaction without the assumption of central control. Choreography Choreography Monday, April](https://reader036.fdocuments.in/reader036/viewer/2022071409/6102e7c36b9d7a5faa42f243/html5/thumbnails/26.jpg)
The dream of BPEL: an engine implements your business based upon the BPEL specification, interpreted as a program. Problem with BPEL: very difficult to "reuse" sections of BPEL, because they rely upon local state that might not be relevant except in the specific BPEL.The dream of WS-CDL: define best practices for interacting with specific services, independent of the application! WS-CDL is not intended as an exhaustive description of a process, but rather, a more comprehensive description of "how to use" a service than its WSDL.
The dream of WS-CDL
The dream of WS-CDLMonday, April 05, 20104:59 PM
Choreography Page 26