Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
BPEL
Business Process Execu/on Language
Friday, April 20, 12
• What do we mean by Business Process Automation and workflow technologies?
• What are the technologies and standards that constitute the SOA approach for Business Process Automation?
• What are the prospects for adoption of BPEL and the future direction of standards-based Business Process Automation leveraging web services?
Key Questions
Friday, April 20, 12
• A business process is a collection of interrelated tasks, which are designed to deliver a particular result
• Types of business processes
• Management processes - processes that govern the operation of a system
• Operational processes - processes that constitute the core activities of the business and delivers the primary value of the organization
• Loan Approval Example
• Supporting processes - which support the core processes
• A business process can be decomposed into several sub-processes, which have their own attributes, but are aligned with the goal of the overall process
• The analysis of business processes typically includes the mapping of processes and sub-processes down to an activity level
• Business processes can be automated through BPM software and workflow
Business Processes
Friday, April 20, 12
IT becomes the enabler of business agility through the systemization of flexible processes
However…
Business processes, by nature, are a challenge to identify, document, implement, and change
What do we want to achieve?
Friday, April 20, 12
• Who Should?
• Who is involved in the process
• Do What?
• What tasks/activities need to be performed
• To What?
• What entities (objects) and data involved
• When?
• What starts and stops the process
• In What Order?
• What is the sequence and interrelationship between tasks
• Why?
• What is the value proposition of using workflow
Business Process Automation
Friday, April 20, 12
• Improve the speed of a business process
• Improve the consistency of a business process
• Improve the quality of a business process
• Automated solutions for adding flexibility
Benefits of workflow automation
Friday, April 20, 12
• Basic Control Flow
• Sequence
• Parallel Split
• Synchronization
• Exclusive Choice
• Advanced Branching and Synchronization
• Multi-Choice
• Structured Synchronizing Merge
• Multi-Merge
• Structured Discriminator
• Blocking Discriminator
• Multiple Instance Patterns
• Multiple Instances without Synchronization
• Multiple Instances with a Priori Design-Time Knowledge
• Multiple Instances with a Priori Run-Time Knowledge
• State-Based Patterns
• Deferred Choice
• Interleaved Parallel Routing
• Milestone
• Cancellation and Force Completion Patterns
• Cancel Task
• Cancel Case
• Interaction Patterns
• Arbitrary Cycles
• Structured Loop
• Recursion
• Termination Patterns
• Implicit Termination
• Explicit Termination
• Trigger Patterns
• Transient Trigger
• Persistent Trigger
Workflow Patterns
workflowpatterns.com
Friday, April 20, 12
Messaging
Quality of Service
Transport
Description
Components
Transport
Interface + Bindings
Composite
XML Non-XML
Security
Policy
Discovery, N
egotiation, Agreement
Atomic
Orchestration Protocols State
ReliableMessaging Transactions
ComponentModel
Web Service Standards for SOA
Friday, April 20, 12
Messaging
Quality of Service
Transport
Description
Components
Transport
Interface + Bindings
Composite
XML Non-XML
Security
Policy
Discovery, N
egotiation, Agreement
Atomic
Orchestration Protocols State
ReliableMessaging Transactions
ComponentModel
Web Service Standards for SOA
Friday, April 20, 12
Messaging
Quality of Service
Transport
Description
Components
Transport
Interface + Bindings
Composite
XML Non-XML
Security
Policy
Discovery, N
egotiation, Agreement
Atomic
Orchestration Protocols State
ReliableMessaging Transactions
ComponentModel
WS-RM
WSDL* WS-Policy*
HTTP, TCP/IP, SMTP, FTP, …
UD
DI, W
S-Addressing, M
etadata Exchange.,…
WS-CWS-N* WS-RFWS-BPEL
WS-Security*WS-AT WS-BA
SOAP, WS-Addr* JMS, RMI/IIOP, ...
SCA
Web Service Standards for SOA
Friday, April 20, 12
• Business Process Execution Language (BPEL) is a language for describing business processes based on Web Services
• Processes described using BPEL execute functionality by using Web Service interfaces exclusively
• BPEL Specification is administered by OASIS
• BPEL is an orchestration language, not a choreography language
• Orchestration specifies an executable process that involves message exchanges with other systems, such that that the message exchange sequences are controlled by the orchestration designer.
• Choreography specifies a protocol for peer-to-peer interactions, defining the legal sequences of messages exchanged with the objective of guaranteeing interoperability
• A choreography is not directly executable
• A choreography can be implemented through an orchestration (i.e. a BPEL process)
Business Process Execution Language
Friday, April 20, 12
Graphical History of the Standard
Friday, April 20, 12
• Dec 2000
• Microsoft publishes XLANG
• March 2001
• IBM publishes WSFL
• July 2002
• IBM, Microsoft, BEA converge WSFL and XLANG into BPEL4WS 1.0
• March 2003
• BPEL4WS is submitted to OASIS
• May 2003
• OASIS publishes BPEL4WS 1.1
• April 2007
• WS-BPEL 2.0 standard
History of BPEL 2.0
Friday, April 20, 12
• Business processes defined using an XML-based language
• Web services are the model for process decomposition and assembly
• The same orchestration concepts are used for both the external (abstract) and internal (executable) views of a business process
• Both hierarchical and graph-like control regimes are used
• An identification mechanism for process instances is provided at the application message level
• The basic lifecycle mechanism is in implicit creation and termination of process instances.
• A long-running transaction model is defined to support failure recovery for parts of long-running business processes
• Language built on compatible Web services standards in a composable and modular manner
BPEL Design Goals
Friday, April 20, 12
process
XMLschemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
process
imports
Declare dependencies on external XML Schema or WSDL definitions extensions
Declare namespaces of WS-BPEL extension attributes and
elements
XMLschemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
process
imports
Declare dependencies on external XML Schema or WSDL definitions extensions
Declare namespaces of WS-BPEL extension attributes and
elements
partnerlinks
Relationships that a WS-BPEL process will employ in its behavior
messageexchanges
Relationship between inbound and outbound message
activities
XMLschemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
process
imports
Declare dependencies on external XML Schema or WSDL definitions extensions
Declare namespaces of WS-BPEL extension attributes and
elements
variablesData holding state of a business process or exchanged with partners
partnerlinks
Relationships that a WS-BPEL process will employ in its behavior
correlationsets
Application data fields that together identify a
conversation
messageexchanges
Relationship between inbound and outbound message
activities
XMLschemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
process
imports
Declare dependencies on external XML Schema or WSDL definitions extensions
Declare namespaces of WS-BPEL extension attributes and
elements
variablesData holding state of a business process or exchanged with partners
partnerlinks
Relationships that a WS-BPEL process will employ in its behavior
correlationsets
Application data fields that together identify a
conversation
messageexchanges
Relationship between inbound and outbound message
activities
eventhandlers
Concurrently process inbound messages or timer alarms
faulthandlers
Deal with exceptional situations in a process
XMLschemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
process
imports
Declare dependencies on external XML Schema or WSDL definitions extensions
Declare namespaces of WS-BPEL extension attributes and
elements
variablesData holding state of a business process or exchanged with partners
partnerlinks
Relationships that a WS-BPEL process will employ in its behavior
correlationsets
Application data fields that together identify a
conversation
messageexchanges
Relationship between inbound and outbound message
activities
eventhandlers
Concurrently process inbound messages or timer alarms
faulthandlers
Deal with exceptional situations in a process
primaryactivityPerform the process logic –
any number of activities may be recursively nested XML
schemas
WSDLdefinitions
Process Definition
Friday, April 20, 12
Structure of a BPEL Process<process ...>
<partners> ... </partners> <!-‐-‐ Web services the process interacts with -‐-‐> <variables> ... </variables> <!– Data used by the process -‐-‐> <correlationSets> ... </correlationSets> <!– Used to support asynchronous interac/ons -‐-‐> <faultHandlers> ... </faultHandlers> <!–Alternate execu/on path to deal with faulty condi/ons -‐-‐>
<eventHandlers> ... </eventHandlers> <!–Concurrent execu/on paths -‐-‐> <compensationHandlers> ... </compensationHandlers> <!–Code to execute when “undoing” an ac/on -‐-‐> (activities)* <!– What the process actually does -‐-‐>
</process>
Friday, April 20, 12
Loan Approval Process
PortType of the WSDL service
Financial Institution‘sWeb Service
(Loan Approver)
invoke
Interfaces exposed by the BPEL process
Interfaces used by the BPEL processes
receive
reply
Recursive Composition
• BPEL processes interact with the services through the WSDLs they expose
• BPEL processes offer services through a WSDL
Friday, April 20, 12
Partners• Actors that are external to the process and with which the process interacts• They can offer services or use the services offered by the process• They are defined by their services through WSDL• The rela/ons between partners are specified through partner links• A partner link is an instance of a partner link type that defines the rela/onship between two generic services (even when a process does not exist yet)
PartnerLink Type
Port Type 1 Port Type 2
Process 1 Process 2
Friday, April 20, 12
portType and partnerLink
portTypes offeredby our process
What we want to havefrom the other services
Friday, April 20, 12
partnerLinkType
• The relationship between two services is defined by means of roles– Each role is associated with a portType
• How many roles – One role if one part only provides operations– Two roles if both parties provide operations
• This usually means– One role when the communication is synchronous– Two roles when the communication is asynchronous
• The definition of partnerLinkTypes is part of the process’ WSDL
Friday, April 20, 12
partnerLink
• Instance of a partnerLinkType
• Defined within the BPEL process
• Specifies the actual actors that play the roles
– myRole identifies the role played by the process - uses EPR
– partnerRole identifies the role played by the other service - uses EPR
• It defines one or two roles depending on the associated partnerLinkType
<partnerLinks> <partnerLink name="NCName" partnerLinkType="QName" myRole="NCName"? partnerRole="NCName"? initializePartnerRole="yes|no"? />+</partnerLinks>
Friday, April 20, 12
Variables
• Necessary to maintain the process state
• Their types can be:
– A message
– A simple XML type
– A complex XML type
• They allow us to save the contents of messages
<variables> <variable name="BPELVariableName" messageType="QName"? type="QName"? element="QName"?>+ from-spec? </variable></variables>
Friday, April 20, 12
Using Variables
22
process
Friday, April 20, 12
Using Variables
22
process
WSDLmessage
WSDLmessage
WSDLmessages
Variables defined using WSDL messages
Friday, April 20, 12
Using Variables
22
process
WSDLmessage
WSDLmessage
WSDLmessages
Variables defined using WSDL messages
42XMLschemas
XML Schemaelements / types
Variables defined using XML schema elements or types
Friday, April 20, 12
Using Variables
22
process
assign
xsl:transform
receive
request
response
invoke
request
reply
response
42
WSDLmessage
WSDLmessage
WSDLmessages
Variables defined using WSDL messages
42XMLschemas
XML Schemaelements / types
Variables defined using XML schema elements or types
Friday, April 20, 12
Properties
• General way of naming and representing distinguished data elements
– usually have a process-wide relevance
• Separates its use in the business logic from its structure
– the variable’s structure is free to evolve while the process references the property
23
<wsdl:definitions name="NCName"> <vprop:property name="NCName" type="QName"? element="QName"? /> ...</wsdl:definitions>
Friday, April 20, 12
Property Aliases
• A property alias maps a property to a field in a specific message part or variable value
• object bpel:getVariableProperty(string, string)
– This function extracts property values from variables.
• The first argument names the source variable for the data and
• the second is the QName of the property to select from that variable
24
<vprop:propertyAlias propertyName="QName" messageType="QName"? part="NCName"? type="QName"? element="QName"?> <vprop:query queryLanguage="anyURI"?>? queryContent </vprop:query> </vprop:propertyAlias>
Friday, April 20, 12
Data Handling• BPEL provides an extensible mechanism for the language used in queries and expressions.
• The languages are specified by the queryLanguage and expressionLanguage attributes of the process element.
– Default is XPath 1.0
• The <assign> activity can be used to copy data from one variable to another, or to construct and insert new data using expressions.
25
<assign validate="yes|no"? standard-attributes> standard-elements ( <copy keepSrcElementName="yes|no"? ignoreMissingFromData="yes|no"?> from-spec to-spec </copy> | <extensionAssignOperation> assign-element-of-other-namespace </extensionAssignOperation> )+</assign>
Friday, April 20, 12
Data Handling• Expressions operate on variables, properties, and literal constants to produce a new value.
• The <assign> activity can also be used to copy EPRs to and from partnerLinks
26
<from variable="BPELVariableName" part="NCName"?> <query queryLanguage="anyURI"?>? queryContent </query></from><from partnerLink="NCName" endpointReference="myRole | partnerRole" /><from variable="BPELVariableName" property="QName" /><from expressionLanguage="anyURI"?>expression</from><from><literal>literal value</literal></from><from/>
<to variable="BPELVariableName" part="NCName"?> <query queryLanguage="anyURI"?>? queryContent </query></to><to partnerLink="NCName" /><to variable="BPELVariableName" property="QName" /><to/>
Friday, April 20, 12
Advanced Data Handling• Supports XSL Transformations
27
<variables> <variable name="A" element="foo:AElement" /> <variable name="B" element="bar:BElement" /></variables>...<sequence> <invoke ... inputVariable="..." outputVariable="A" /> <assign> <copy> <from> bpel:doXslTransform("urn:stylesheets:A2B.xsl", $A) </from> <to variable="B" /> </copy> </assign> <invoke ... inputVariable="B" ... /></sequence>
Friday, April 20, 12
• How to identify stateful instances via stateless WS interfaces?
• A process instance is assigned one or more keys
• Business data is used as key, e.g., customerID
• A key can be compound, e.g., (customerID, orderNumber)
• BPEL calls a key a correlation set – it is used to correlate an incoming message with a process instance
Process 4(0123,15)
Process 3(0815,42)
Process 2(4711,37)
Process 1(0815,12)
0815 42
Message 2
customerID
orderNumber
4711 37
Message 1
Correlation Sets
<correlationSets>? <correlationSet name="NCName" properties="QName-list" />+</correlationSets>
Friday, April 20, 12
Basic ac/vi/es
process
receive reply
invokeInvoke a one-way or request-response operation
Do a blocking wait for a matching message to arrive / send a message in reply
validate
assignUpdate the values of variables or partner links with new data
Validate XML data stored in variables
exit
Immediately terminate execution of a business process
instance
waitWait for a given time period or until a certain time has passed
emptyNo-op instruction for
a business process
extensionActivityWrapper for language
extensions
Friday, April 20, 12
<receive>• The execution of a receive can activate the execution of a new process instance
– This is specified through attribute createInstance
– The default value is no
– We need at least one receive to activate the process
<receive partnerLink="NCName" portType="QName"? operation="NCName" variable="BPELVariableName"? createInstance="yes|no"? standard-attributes> standard-elements <correlations>? <correlation set="NCName" initiate="yes|join|no"? />+ </correlations> <fromParts>? <fromPart part="NCName" toVariable="BPELVariableName" />+ </fromParts></receive>
Friday, April 20, 12
<reply>
31
<reply partnerLink="NCName" portType="QName"? operation="NCName" variable="BPELVariableName"? faultName="QName"? standard-attributes> standard-elements <correlations>? <correlation set="NCName" initiate="yes|join|no"? />+ </correlations> <toParts>? <toPart part="NCName" fromVariable="BPELVariableName" />+ </toParts></reply>
Friday, April 20, 12
<invoke>
<invoke partnerLink="NCName" portType="QName"? operation="NCName" inputVariable="BPELVariableName"? outputVariable="BPELVariableName"? standard-attributes> standard-elements</invoke>
• One way invocation• only inputVariable
• Request-response• both inputVariable and outputVariable
Friday, April 20, 12
Structured Activities
33
process
flowContained activities are executed in parallel, partially ordered through control links
sequenceContained activities are performed sequentially in lexical order
whileContained activity is repeated while a predicate holds
repeatUntilContained activity is repeated until a predicate holds
pick Block and wait for a suitable message to arrive (or time out)
forEach Contained activity is performed sequentially or in parallel, controlled by a specified
counter variable
if-elseif-else Select exactly one branch of activity from a set of choices
scope Associate contained activity with its own local variables, partner
links, etc., and handlers
2. N.1. …
B C
A
c
c
c1 c2…
2. N.1. …
… AM2M1
Friday, April 20, 12
Structured activities
<sequence> <receive .../> <flow> <sequence> <invoke .../> <while ... > <assign>...</assign> </while> </sequence> <sequence> <receive .../> <invoke ... > </sequence> </flow> <reply></sequence>
receive
invoke
invoke
assign
sequence
sequencesequence
while
receive
reply
flow
Friday, April 20, 12
Sequence
35
<sequence standard-attributes> activity+</sequence>
<sequence> <flow>...</flow> <scope>...</scope> <pick>...</pick></sequence>
Friday, April 20, 12
If-Then-Else
36
<if> <condition expressionLanguage="anyURI"?>bool-expr</condition> activity <elseif>* <condition expressionLanguage="anyURI"?>bool-expr</condition> activity </elseif> <else>? activity </else></if>
Friday, April 20, 12
If-Then-Else
36
<if xmlns:inventory="http://supply-chain.org/inventory" xmlns:FLT="http://example.com/faults"> <condition> bpel:getVariableProperty('stockResult','inventory:level') > 100 </condition> <flow> <!-- perform fulfillment work --> </flow> <elseif> <condition> bpel:getVariableProperty('stockResult','inventory:level') >= 0 </condition> <throw faultName="FLT:OutOfStock" variable="RestockEstimate" /> </elseif> <else> <throw faultName="FLT:ItemDiscontinued" /> </else></if>
Friday, April 20, 12
While
37
<while standard-attributes> <condition expressionLanguage="anyURI"?>bool-expr</condition> activity</while>
<while> <condition>$orderDetails > 100</condition> <sequence>...</sequence></while>
Friday, April 20, 12
Pick
38
<pick createInstance="yes|no"? standard-attributes> <onMessage partnerLink="NCName" portType="QName"? operation="NCName" variable="BPELVariableName"? <correlations>? <correlation set="NCName" initiate="yes|join|no"? />+ </correlations> <fromParts>? <fromPart part="NCName" toVariable="BPELVariableName" />+ </fromParts> activity </onMessage> <onAlarm>* ( <for expressionLanguage="anyURI"?>duration-expr</for> | <until expressionLanguage="anyURI"?>deadline-expr</until> ) activity </onAlarm></pick>
Friday, April 20, 12
Pick
38
<pick> <onMessage partnerLink="buyer" portType="orderEntry" operation="inputLineItem" variable="lineItem"> <!-- activity to add line item to order --> </onMessage> <onMessage partnerLink="buyer" portType="orderEntry" operation="orderComplete" variable="completionDetail"> <!-- activity to perform order completion --> </onMessage> <!-- set an alarm to go off 3 days and 10 hours after the last order line --> <onAlarm> <for>'P3DT10H'</for> <!-- handle timeout for order completion --> </onAlarm></pick>
Friday, April 20, 12
Flow
39
<flow standard-attributes> <links>? <link name="NCName">+ </links> activity+</flow>
<sequence> <flow> <invoke partnerLink="Seller" ... /> <invoke partnerLink="Shipper" ... /> </flow> <invoke partnerLink="Bank" name="transferMoney" ... /></sequence>
Friday, April 20, 12
Synch links
40
<targets>? <joinCondition expressionLanguage="anyURI"?>? bool-expr </joinCondition> <target linkName="NCName" />+</targets> <sources>? <source linkName="NCName">+ <transitionCondition expressionLanguage="anyURI"?>? bool-expr </transitionCondition> </source></sources>
Friday, April 20, 12
Example of synch links
41
Friday, April 20, 12
Example of synch links
41
<flow suppressJoinFailure="yes"> <links> <link name="buyToSettle" /> <link name="sellToSettle" /> <link name="toBuyConfirm" /> <link name="toSellConfirm" /> </links> <receive name="receiveBuyerInformation" ...> <sources> <source linkName="buyToSettle" /> </sources> </receive> <receive name="receiveSellerInformation" ...> <sources> <source linkName="sellToSettle" /> </sources> </receive>
<invoke name="settleTrade" ...> <targets> <joinCondition>$buyToSettle and $sellToSettle </joinCondition> <target linkName="buyToSettle" /> <target linkName="sellToSettle" /> </targets> <sources> <source linkName="toBuyConfirm" /> <source linkName="toSellConfirm" /> </sources> </invoke> <reply name="confirmBuyer" ...> <targets> <target linkName="toBuyConfirm" /> </targets> </reply> <reply name="confirmSeller" ...> <targets> <target linkName="toSellConfirm" /> </targets> </reply></flow>
Friday, April 20, 12
ForEach
42
<forEach counterName="BPELVariableName" parallel="yes|no"> <startCounterValue expressionLanguage="anyURI"?> unsigned-integer-expression </startCounterValue> <finalCounterValue expressionLanguage="anyURI"?> unsigned-integer-expression </finalCounterValue> <completionCondition>? <branches expressionLanguage="anyURI"? successfulBranchesOnly="yes|no"?>? unsigned-integer-expression </branches> </completionCondition> <scope ...>...</scope></forEach>
Friday, April 20, 12
Scopes
process
scope
scope
scope
scope
Scopes provide a context which influences the execution behavior of its enclosed activities
Isolated scopes provide control of concurrent access to shared resources
scope
Local declarations – partner links, variables, correlation sets
Local handlers – event handlers, fault handlers, a termination handler, and a compensation handler
primary activity
Friday, April 20, 12
Scopes
44
<scope isolated="yes|no"? exitOnStandardFault="yes|no"? standard-attributes> standard-elements <variables>? ... </variables> <partnerLinks>? ... </partnerLinks> <correlationSets>? ... </correlationSets>
<eventHandlers>? ... </eventHandlers> <faultHandlers>? ... </faultHandlers> <compensationHandler>? ... </compensationHandler> activity</scope>
Friday, April 20, 12
Compensation Handler
• Allows the definition of compensation logic, together with forward logic
– underpinning of BPEL’s error handling framework
• Always attached to a completed scope.
– Can be attached inline to an invoke for simplicity
45
<scope> <compensationHandler> <invoke partnerLink="Seller" portType="SP:Purchasing" operation="CancelPurchase" inputVariable="getResponse" outputVariable="getConfirmation"> </invoke> </compensationHandler> <invoke partnerLink="Seller" portType="SP:Purchasing" operation="Purchase" inputVariable="sendPO" outputVariable="getResponse"> </invoke></scope>
Friday, April 20, 12
Process State Usage in CHs• A compensation handler always uses the current state of the process at the time the
compensation handler is executed.
– from its associated scope and all enclosing scopes
– includes the state of variables, partner links and correlation sets.
• Compensation handlers are able to both read and write the values of all such data
46
Friday, April 20, 12
Fault Handler• It is a mode switch from the normal processing in a scope.
• Designed to be treated as "reverse work," in that its aim is to undo the partial and unsuccessful work of a scope in which a fault has occurred.
– can launch compensation handlers for completed scopes (not for the same scope!)
• The completion of the activity of a fault handler, even when it does not rethrow the handled fault, is not considered successful completion of the scope.
• Defined through catch and catchall constructs
47
<faultHandlers> <catch faultName="QName"? faultVariable="BPELVariableName"? ( faultMessageType="QName" | faultElement="QName" )? >* activity </catch> <catchAll>? activity </catchAll></faultHandlers>
Friday, April 20, 12
Catching a Fault
When faults are thrown without associated data the fault MUST be caught as follows:
1. If there is a <catch> construct with a matching faultName value that does not specify a faultVariable attribute then the fault is passed to the identified catch activity.
2. Otherwise if there is a <catchAll> fault handler then the fault is passed to the <catchAll> fault handler.
3. Otherwise, the fault will be handled by the default fault handler
48
Friday, April 20, 12
Catching a Fault
In the case of faults thrown with associated data the fault MUST be caught as follows:
1. matching faultName value, faultVariable whose type matches the type of the fault data
2. fault data is a WSDL message type, matching faultName value, faultVariable’s associated faultElement’s QName matches the QName of the runtime element data
3. matching faultName value, no faultVariable attribute
4. no faultName attribute, faultVariable whose type matches the type of the runtime fault data
5. fault data is a WSDL message type, no faultName attribute, faultVariable whose associated faultElement’s QName matches the QName of the runtime element data
6. <catchAll>
7. default fault handler
49
Friday, April 20, 12
Termination
• The behavior of a fault handler for a scope C begins by
– disabling the scope's event handlers and
– implicitly terminating all activities enclosed within C that are currently active
• The <assign> activities are sufficiently short-lived that they MAY be allowed to complete
• <wait>, <receive>, <reply> and <invoke> activity MUST be interrupted and terminated prematurely. When a request-response <invoke> is interrupted and terminated prematurely, the response (if received) for such a terminated activity MUST be ignored.
• The <empty>, <throw> and <rethrow> activities MAY be allowed to complete.
• The <exit> activity, once started, MUST NOT be terminated
50
Friday, April 20, 12
Termination
51
• The iteration of <while>, <repeatUntil>, and serial <forEach> MUST be interrupted and termination MUST be applied to the loop body activity.
• For a parallel <forEach>, termination MUST be applied to all parallel executing branches.
• If an <if> or <pick> activity has already selected a branch, then the termination MUST be applied to the activity of the selected branch. If either of these activities has not yet selected a branch, then the <if> or <pick> activity itself MUST be terminated immediately.
• The <sequence> and <flow> constructs MUST be terminated by terminating their behavior and applying termination to all nested activities currently active within them.
• The <compensateScope> and <compensate> activity MUST be terminated by propagating the termination to the invoked compensation handler instances and applying termination to the activities of the compensation handlers.
Friday, April 20, 12
Event Handler• Event Handlers run concurrently and are invoked when the corresponding event occurs
• There are two types of events.
– inbound messages that correspond to a WSDL operation
– alarms, that go off after user-set times
52
<onEvent partnerLink="NCName" portType="QName"? operation="NCName" ( messageType="QName" | element="QName" )? variable="BPELVariableName"?>* <scope ...>...</scope> </onEvent>
<onAlarm>* ( <for expressionLanguage="anyURI"?>duration-expr</for> | <until expressionLanguage="anyURI"?>deadline-expr</until>)? <repeatEvery expressionLanguage="anyURI"?>? duration-expr </repeatEvery> <scope ...>...</scope> </onAlarm>
Friday, April 20, 12
Isolated Scopes
• The isolated attribute of a scope, when set to "yes", provides control of concurrent access to shared resources: variables, partner links, and control dependency links
• Two concurrent isolated scopes, S1 and S2, access a common set of variables and partner links.
– Isolation ensures that the results would be no different if all activities on all shared data were reordered so that either all such activities within S1 are completed before any in S2 or vice versa.
53
Friday, April 20, 12
Example
compensa=onhandler
chargecredit card
refundcustomer ship
goods
faulthandler
no=fymanager
compensatefault
handler
rethrow
Process
flow
scopescope
Friday, April 20, 12
Abstract Processes
• Different use cases
– standard provides a common base and profiles (identified by URIs) for refinement
• Common base
– abstractProcessProfile attribute must exist and point to a profile definition
– all constructs for executable processes are permitted
– certain syntactic constructs may be hidden
• opaque placeholder for activities, expressions, from specs (Assign)
• can be used for defining extension points
– must be syntactically valid
– may omit the createInstance property
55
Friday, April 20, 12
Process Completion
• Executable Completion is a process derived by
– changing the namespace to executable and removing the profile URI
– syntactic transformations
• opaque token replacement
• addition of BPEL constructs
– validating the resulting process
• Basic Executable Completion is an executable completion in which transformations are
– opaque token replacement
– addition of a start activity
– addition of imports, partnerLinks, and variables at the process level
56
Friday, April 20, 12
Profile for Observable Behaviour• for the definition of business process contracts
– hide private aspects of execution
– rich data manipulation is not needed (opaque Assigns)
• Executable Completions
– can add additional interactions with other partners (existing vs new)
– should not change order of existing interactions
– data writings may change control flow! Beware!
– existing EPRs should not be changed
– lexical parent of an existing activity must never be changed
• cannot add nesting (while, scope, etc.)
– must not add new branches to if structures (unless it is an else)
– must not add new branches to pick structures
– must not add new handlers to a scope (ok on process level)
– must not add new exit structures
– must not hide variable declarations by adding new ones in scopes
57
Friday, April 20, 12
Template Profile• For describing a process within an organiza/on at design-‐/me
– hides arbitrary implementa/on details
– allows organiza/ons to “fill in the blanks” later
• template:createInstance extension attribute to mark an opaque activity as a start activity
• Explicit opaque tokens must be used to mark where new activities will be added
• No omission shortcuts are allowed
• All new start activities must substitute opaque activities with a template:createInstance property
• Only things that can be added:
– correlations (if none are already there)
– data declarations
– handlers
– import at the process level
58
Friday, April 20, 12
The Shipping Service
• Offers 2 options
– shipping of all goods
– shipping of partial goods
59
<plnk:partnerLinkType name="shippingLT"> <plnk:role name="shippingService" portType="sif:shippingServicePT" /> <plnk:role name="shippingServiceCustomer" portType="sif:shippingServiceCustomerPT" /> </plnk:partnerLinkType>
Friday, April 20, 12
Messages and Port Types
60
<wsdl:definitions targetNamespace="" xmlns:ship="" xmlns:tns= "" xmlns:wsdl=""xmlns:xsd=""> <wsdl:types> <xsd:schema> <!-- import ship schema --> </xsd:schema> </wsdl:types> <wsdl:message name="shippingRequestMsg"> <wsdl:part name="shipOrder"
type="ship:shipOrder" /> </wsdl:message> <wsdl:message name="shippingNoticeMsg"> <wsdl:part name="shipNotice"
type="ship:shipNotice" /> </wsdl:message>
<wsdl:portType name="shippingServicePT"> <wsdl:operation name="shippingRequest"> <wsdl:input
message="tns:shippingRequestMsg" /> </wsdl:operation> </wsdl:portType> <wsdl:portType
name="shippingServiceCustomerPT"> <wsdl:operation name="shippingNotice"> <wsdl:input
message="tns:shippingNoticeMsg" /> </wsdl:operation> </wsdl:portType></wsdl:definitions>
Friday, April 20, 12
Proper/es
61
<wsdl:types> <xsd:schema targetNamespace="http://example.com/shipping/ship.xsd"> <xsd:simpleType name="itemCountType"> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="1" /> <xsd:maxInclusive value="50" /> </xsd:restriction> </xsd:simpleType> </xsd:schema> </wsdl:types>
<vprop:property name="shipOrderID" type="xsd:int" /><vprop:property name="shipComplete" type="xsd:boolean" /><vprop:property name="itemsTotal" type="ship:itemCountType" /><vprop:property name="itemsCount" type="ship:itemCountType" />
Friday, April 20, 12
Property Aliases
62
<vprop:propertyAlias propertyName="tns:shipOrderID" messageType="sif:shippingRequestMsg" part="shipOrder"> <vprop:query> ship:ShipOrderRequestHeader/ship:shipOrderID </vprop:query> </vprop:propertyAlias> <vprop:propertyAlias propertyName="tns:shipOrderID" messageType="sif:shippingNoticeMsg" part="shipNotice"> <vprop:query>ship:ShipNoticeHeader/ship:shipOrderID</vprop:query> </vprop:propertyAlias> <vprop:propertyAlias propertyName="tns:shipComplete" messageType="sif:shippingRequestMsg" part="shipOrder"> <vprop:query> ship:ShipOrderRequestHeader/ship:shipComplete </vprop:query> </vprop:propertyAlias>
Friday, April 20, 12
Property Aliases
63
<vprop:propertyAlias propertyName="tns:itemsTotal" messageType="sif:shippingRequestMsg" part="shipOrder"> <vprop:query> ship:ShipOrderRequestHeader/ship:itemsTotal </vprop:query> </vprop:propertyAlias> <vprop:propertyAlias propertyName="tns:itemsCount" messageType="sif:shippingRequestMsg" part="shipOrder"> <vprop:query> ship:ShipOrderRequestHeader/ship:itemsCount </vprop:query> </vprop:propertyAlias> <vprop:propertyAlias propertyName="tns:itemsCount" messageType="sif:shippingNoticeMsg" part="shipNotice"> <vprop:query>ship:ShipNoticeHeader/ship:itemsCount</vprop:query> </vprop:propertyAlias>
Friday, April 20, 12
The process
64
receive shipOrder if condition shipComplete send shipNotice else itemsShipped := 0 while itemsShipped < itemsTotal itemsCount := opaque // non-deterministic assignment // corresponding e.g. to // internal interaction with // back-end system send shipNotice itemsShipped = itemsShipped + itemsCount
Friday, April 20, 12
The process
65
<partnerLinks> <partnerLink name="customer" partnerLinkType="plt:shippingLT" partnerRole="shippingServiceCustomer" myRole="shippingService" /> </partnerLinks> <variables> <variable name="shipRequest" messageType="sif:shippingRequestMsg" /> <variable name="shipNotice" messageType="sif:shippingNoticeMsg" /> <variable name="itemsShipped" type="ship:itemCountType" /> </variables>
Friday, April 20, 12
The process
66
<sequence> <receive partnerLink="customer" operation="shippingRequest" variable="shipRequest"> </receive> <if> <condition> bpel:getVariableProperty('shipRequest','props:shipComplete') </condition> <sequence> <assign> <copy> <from variable="shipRequest" property="props:shipOrderID" /> <to variable="shipNotice"property="props:shipOrderID" /> </copy> <copy> <from variable="shipRequest" property="props:itemsCount" /> <to variable="shipNotice" property="props:itemsCount" /> </copy> </assign> <invoke partnerLink="customer"operation="shippingNotice"
inputVariable="shipNotice"> </invoke> </sequence>
Friday, April 20, 12
The Process
67
<else> <sequence> <assign><copy><from>0</from> <to>$itemsShipped</to></copy></assign> <while> <condition> $itemsShipped < bpel:getVariableProperty('shipRequest',props:itemsTotal') </condition> <sequence> <assign><copy><opaqueFrom/><to variable="shipNotice" property="props:shipOrderID" /> </copy> <copy><opaqueFrom/><to variable="shipNotice" property="props:itemsCount" /> </copy></assign> <invoke partnerLink="customer" operation="shippingNotice" inputVariable="shipNotice"> </invoke> <assign><copy><from>$itemsShipped+bpel:getVariableProperty('shipNotice','props:itemsCount') </from> <to>$itemsShipped</to> </copy></assign> </sequence> </while> </sequence></else></if></sequence>
Friday, April 20, 12
BPEL’s Limits
• Closed solution – In treating dynamic BPEL processes only dynamic binding is supported • dynamic modification of partnerLinks
• The execution is a possible bottleneck– Many research projects tend towards distributed processes
• Limited expressiveness– Pushes engine producers to introduce non-standard activities to invoke components
that are not web services
Friday, April 20, 12
Addi/onal Material
69
Friday, April 20, 12
Loan Approval BPMN
70
calculateRisk
thoroughAssessment
loanRequest
amount >= 10000
amount < 10000
loan[approved]
risk == low
risk != low
loan[decision]
Go back...
Friday, April 20, 12