3 Replies Latest reply on Sep 17, 2008 11:14 AM by Jonathan Halliday

    TerminationCoordinator and TerminationParticipant

    Guzman Llambi­as Novice

      Hi, watching the SOAP messages exchanged in the BA example I found that there exists a TerminationCoordinator and a TerminationParticipant besides the BACoordinator and BAParticipant. Is there any relationship between them or are different entities?

      I realized that the BAParticipant is related to the Taxi/Theatre/Restaurant Service, and the TerminationParticipant with the uba.close(); on the BasicClient, but what I don't understand very much is how when the TerminationParticipant sends Close to the TerminatonCoordinator, then the BACoordinator sends Close to the BAParticipant. Are the TerminationCoordinator and BACoordinator the same?

      Thanks
      Guzman

        • 1. Re: TerminationCoordinator and TerminationParticipant
          Andrew Dinn Master

          If you look at the BA WSDL you will notice that it only defines 4 services, the Coordinator and Participant services which negotiate using Coordinator driven completion and the Coordinator and Participant services which negotiate using Participant driven completion. These services allow a Coordinator and a transactional web service (the Participant) to manage the progress of the transaction, So, how do these get invoked? And what about the third party, the BA client?

          The WS-C Activation service provides a way for a transactional _client_ to start a business activity (the Activation service notifies the BA coordinator service and returns a context to the client containing the coordinator's address). The BA specification defines two types of activity, BA Atomic Outcome or BA Mixed outcome, but most implementations (including JBossTS XTS) only support the first type.

          The Registration service allows a transactional web service to enlist itself as a participant in an activity. This is normally done when a client sends a web request with a context attached (as a SOAP header). The Registration service notifies the BA coordinator service that there is a new participant (passing the id of the activity and the participant's address) and returns a unique participant id and the coordinator's address to the participant. The BA spec allows for registration of two flavours of participant: ones which make their own decision that the work to be done by the service is complete (Participant completion); and ones which rely upon the client to tell them that the work to be done by the service is complete (Coordinator completion).

          In the first case (participant completion) the web service will process one or more requests from the client and at some point decide to tell the coordinator that it has completed, possibly checkpointing its transactional data ready to complete or cancel. The common case is that the service processes a single web request and then completes (e.g. the request is something like process order) although other behaviours are possible (e.g. the requests form a sequence like add to cart, add to cart, delete from cart, go to checkout, confirm)

          In the second case the web service will keep performing transactional requests in the scope of the activity until the BA coordinator sends it a completed message. Only then will it do something like checkpointing its data and send back a completed message. Note that it is the _coordinator_, not the client, which sends a complete message to the participants.

          So, there is still a missing piece to the puzzle. How does the client tell the coordinator that it wants to complete and then either cancel or close the business activity? This is not actually specified in the BA spec. It is done using a Termination Coordinator service and Termination Participant service.

          After creating a context a client always calls the Registration service to register for the BA Termination Coordinator service. It passes the id of the business activity and the address of its Termination Participant service as an end point for replies. The Registration service notifies the Termination Coordinator and returns its address to the client with a unique Termination Participant id. These services are not BA services, they are defined by JBoss XTS. Every BA implementation needs a service of this sort but the BA spec does not define them.

          When the client wants to complete the transaction and then either to close it or cancel it this is achieved by sending a message to the Termination Coordinator service. The Termination Coordinator notifies the BA coordinator and the BA coordinator drives the participants to complete or close or cancel. Once the BA coordinator finishes the request it responds to the Termination Coordinator which posts a result back to the client using the Termination Participant service.

          All this happens behind the scenes underneath the BA APIs provided by XTS. So, you don't need to know how it works to use it -- but obviously it helps to have an understanding of it. The XTS demo trailmap explains some of this. If you read the (new and heavily rewritten) XTS Programmer's Guide in the latest JBossTS release (JBossTS 4.4.CR2) you will find this explained with more detail along with a few pictures to make it clearer.

          • 2. Re: TerminationCoordinator and TerminationParticipant
            Guzman Llambi­as Novice

            First of all, thank you very much for this detailed explanation of the BA with JBoss TS. I appreciate it a lot! I was using JBoss TS 4.3 GA an didn't too much about this, so this helps me very much.

            One more little question? Where I can find JBoss TS 4.4CR2. In the download page is only CR1.

            Thanks again!

            Guzman

            • 3. Re: TerminationCoordinator and TerminationParticipant
              Jonathan Halliday Master

              Sorry, no downloads for that release at present. If you need something more recent that CR1 you need to pull src from svn and build it yourself.