HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

The Business Transaction Protocol, by Tyler Jewell
WSJ Vol 01 Issue 01 - pg.25

	


Listing 1

void cohesion()
  {
       // We only need one supplier with the best quote.
Atom supplier1 = new Atom();
Atom supplier2 = new Atom();
Atom supplier3 = new Atom();

// Get quotes from each supplier here (not listed).

// After getting quotes from each supplier, we need to make sure that they
// can commit with the appropriate resources.

supplier1.prepare();  // If no exception, they can fully commit.
supplier2.prepare();  // ditto
supplier3.prepare();  // ditto

// Do business logic here to determine which supplier should be used.
// Let's assume that supplier 2 wins the contract.
//
// The cohesion must be completed by letting each supplier know their
// individual outcome.

supplier1.cancel();
supplier2.confirm();
supplier3.cancel();
    }