380 likes | 479 Vues
Oasis Business Transaction Protocol is a guide for inter-organizational coordination, accommodating long-running transactions, and XML-based communication over multiple protocols to facilitate commercial collaborations. It focuses on multiple successful outcomes, relaxed isolation, and using contracts for governance. The document explains the key BTP roles, transaction phases, provisional, final, and counter effects, demonstrating examples of confirmations and cancellations in transactions. It also explores compensation strategies and XA RM implementations. The protocol outlines participant relationships and transaction tree structures for seamless coordination in complex business scenarios.
E N D
OASIS Business Transaction Protocol:Multi-party Coordination for Commercial Collaborations peter.furniss@choreology.com alastair.green@choreology.com tony.fletcher@choreology.com March 2002
Goals • Inter-organizational multi-party coordination • Targetting Web Services, but not only WS • Accommodate Long-running Transactions
Requirements • Coordination of autonomous parties • Relationships are governed by contracts, rather than the dictates of a central design authority • Drop less ACID • Multiple possible successful outcomes to a transaction • Relaxed isolation, volatile results • Interoperation • Using XML, over multiple communications protocols • Discontinuous service • Work unit lifespans exceed sub-system MTBFs
The key BTP roles Client side Service side Client Service Initiator/Terminator Application Enroller Protocol Factory Transaction Decider(Composer or Coordinator) Participant
Ask Factory to Create top coordinator Client side Service side Client Service Initiator/Terminator Application BEGIN / BEGUN&CONTEXT Enroller Protocol Factory creates Coordinator Participant
Send Application Message with CONTEXT Client side Service side Client Service CONTEXT Initiator/Terminator Application Enroller Protocol Factory Coordinator Participant
Service creates and causes ENROL of Participant Client side Service side Client Service Initiator/Terminator Application Enroller Protocol ENROL / ENROLLED Factory creates Coordinator Participant
Send Application Reply with CONTEXT_REPLY Client side Service side Client Service CONTEXT_REPLY Initiator/Terminator Application Enroller Protocol Factory Coordinator Participant
CONFIRM_TRANSACTION Client side Service side Client Service Initiator/Terminator Application CONFIRM_TRANSACTION Enroller Protocol Factory Coordinator Participant
Two-phase Confirmation: PREPARE phase Client side Service side Client Service Initiator/Terminator Application Enroller Protocol PREPARE / PREPARED Factory Coordinator Participant
Two-phase Confirmation: Outcome phase Client side Service side Client Service Initiator/Terminator Application Enroller Protocol CONFIRM / CONFIRMED Factory Coordinator Participant
TRANSACTION_CONFIRMED Reply Client side Service side Client Service Initiator/Terminator Application TRANSACTION_CONFIRMED Enroller Protocol Factory Coordinator Participant
Cancellation • Example showed CONFIRM/CONFIRMED • Terminating application can also issue CANCEL_TRANSACTION • Or the CONFIRM_TRANSACTION can fail, leading to TRANSACTION_CANCELLED • CANCEL/CANCELLED exchange with Participant
Service and Participant: Provisional effect and Counter-effect • Forward Operations create a provisional effect… • … and durably record information needed by Participant • Participant uses log to perform final effect or tocounter-effect Client side Service side Service A (provisional) Log of A finalise A CONFIRM counter A CANCEL Participant
Provisional, final and counter effects • Provisional effect • Apparently – the application’s forward operation • Really – just do what is needed to do either final or counter • Do something, log (persist) information for final or counter • Final effect – action on CONFIRM • Final effect is action on CONFIRM • Complete the operation so it did happen • Use the information in the log, discard log • Counter effect – action on CANCEL • Counter-effect is action on CANCEL • Make it that the application did not happen (or unhappened) • Use the information in the log, discard the log • May be perfect or have side effects
2PC ACID • Example #1: Compensation strategy • Provisional Effect includes committed database updates or message enqueues • E.g. debit credit card account • Final effect is no-op • Counter-effect involves compensatory action • E.g. contra-credit credit card • In whole or in part depending on business contract • Example #2: XA RM • Provisional Effect posits but does not commit database updates or MQPUTs • Final effect invoke xa_commit • Throw away RM undo logs • Counter-effect is to invoke xa_rollback • Process RM undo logs
Service decides what a Participant covers • Service can combine provisional effects into one Participant • Single confirm or cancel signal • Application specific • Service had the right to create and enrol two participants Operation Group Client side Service side Service A B Log of A, B finalAB CONFIRM counterAB CANCEL Participant
Superior-Inferior Relationship - outcome Superior PREPARE CONFIRM CANCEL Inferior ComposerCoordinatorSub-composerSub-coordinator PREPARED CONFIRMED CANCELLED Sub-composerSub-coordinatorParticipant
Transaction Tree - 1 Inferior [Participant] Superior [e.g. Coordinator] Inferior [Participant] Inferior [Participant]
Transaction Tree - 2 Inferior [Participant] Superior [e.g. Coordinator] Inferior/Superior [e.g. Sub-coordinator] Inferior [Participant] Inferior [Participant]
Transaction Tree - 3 Inferior/Superior [e.g. Sub-coordinators] Inferior [Participant] Superior [Composer] Inferior [Participant] Inferior [Participant]
Coordination Hub: control and outcome relationships Client Service Client Service Application Initiator/Terminator control Enroller outcome Protocol Transaction Decider(Composer or Coordinator) Participant Factory Coordination Hub
Shipping Atom Goods Atom Cohesions: The Concept Buyer Services Inferior Coordinators Superior Cohesion Terminator Superior Composer #1 Inferior Participant #2 Inferiors Participants
Shipping Atom Goods Atom Cohesions: PREPARE both Atoms Buyer Services Inferior Coordinators Superior Cohesion Terminator Superior Composer #1 PREPARE P PREPARE_INFERIORS #1, #2 Inferior Participant P #2 PREPARE PREPARE Inferiors Participants
Shipping Atom Goods Atom Cohesions: both are PREPARED Buyer Services Inferior Coordinators Superior Cohesion Terminator Superior Composer #1 P’d #1 PREPARED P’d INFERIOR_ STATUSES Inferior Participant P’d #2 P’d #2 PREPARED PREPARED Inferiors Participants
Shipping Atom Goods Atom Cohesions: CONFIRM #1 ( CANCEL #2) Buyer Services Inferior Coordinators Superior Cohesion Terminator Superior Composer CONFIRM #1 CONFIRM CONFIRM_TRANSACTION #1 Inferior Participant CANCEL #2 CANCEL CANCEL Inferiors Participants
Shipping Atom Goods Atom Cohesions: #1 CONFIRMED, #2 CANCELLED Buyer Services Inferior Coordinators Superior Cohesion Terminator Superior Composer #1 CO’d #1 CONFIRMED CO’d INFERIOR_ STATUSES Inferior Participant CA’d #2 CA’d #2 CANCELLED CANCELLED Inferiors Participants
Cohesions rely on “Open-top” Coordinator “Open-top” Atom Coordinators Cohesion Terminator Cohesion Composer #1 PREPARE / PREPARED CONFIRM_TRANSACTION #1 CONFIRM / CONFIRMED #1 CO’d INFERIOR_ STATUSES PREPARE / PREPARED #2 CA’d CANCEL / CANCELLED #2
S S S S O O O O Example: Cross-company Securities Trading Stock and option – from different market makers Hedge Fund ABN Amro Nomura Commerz DKB
S S S S O O O O Example: Cross-company Securities Trading Each market maker makes two guaranteed time-qualified quotes = PREPARED, from 2 participants each Hedge Fund ABN Amro Nomura Commerz DKB
S S S S O O O O Example: Cross-company Securities Trading Hedge fund chooses one of each, cancels the others (or lets them timeout) Hedge Fund ABN Amro Nomura Commerz DKB
Participant time-out • Inferior can limit duration of its preparedness • Inferior threatens to auto-cancel or confirm after (at least) n seconds • Inferior qualifies the PREPARED message • Prevents coordinator hogging service provider’s resources • Independent organization likely to demand this power • Risks contradiction – which will be reported • Superior can negotiate the time limit • Superior qualifies the PREPARE message • Prevents service wasting coordinator’s time
Failure Recovery • Protocol incorporates recovery after failure • Superior system, Inferior system or network may fail • Must try to re-establish Superior-Inferior relationship • Allows outcomes to be replayed • Standard “presumed abort” protocol • No durable record (log) equals absence of decision • Default decision (in absence of evidence to contrary): CANCEL • Bi-directional recovery initiation • Superior can attempt to contact logged Inferiors • Inferior can attempt to contact logged Superior
Active phase recovery • Allows Superior/Inferior re-synch after failures • Standard 2PC protocols allow recovery only after prepared • BTP treats failure as a potential interruption • Standard 2PC protocols treat any failure as cause to cancel • Permitted, not required • Presume-abort still applies – just it isn’t compulsory • Useful for long-running transactions • Useful with interruptible communications
Messaging • All BTP messages are XML documents • Can be compounded for optimization • “One-shot requests”: only 2 WAN messages instead of 6 • Application response + ENROL/PREPARE • “One wire” application topologies • All traffic between two business entities over a single, authenticated link • Binding of abstract set to SOAP • Defined in the specification • Other bindings are possible • To any underlying communications protocol stack
Qualifiers • Qualifiers can be embedded in messages • Some are defined within BTP specification • Implementers/applications can define their own • Identified by URI • Allows extensions to protocol messages • trading parties could use to add security data • Implementor could use to add full nested transactions • Allows application data to travel with protocol • Example: confirm a two-way quote • Must include “buy” or “sell” in CONFIRM
Business Transactions and Business Process • BTP complements BP/Collaboration frameworks • A coordinated, mutually understood outcome requires • Special messages and acknowledgements • Consistent, durable record of decisions • Asynchronous failure recovery operations • These features are tricky, error-prone and intrusive • “Build or buy” • BTP lets business people concentrate on business process • Puts housekeeping work in the background • Minimizes application exchanges • Reduces complexity of collaborative process schemas or scripts • Reduces conformance testing • Deploy new trading protocols or conventions more quickly
Internal Business Process Internal Business Process Collaboration Process BTP BTP Collaboration Process Do Business Together with Business Transactions • Ensuring Collaboration for XML Services