A.1.2 Troubleshooting Steps

  1. Java code enters the @LRA annotated method booking() of the TravelAgencyController class.

    A query on DBA_SAGAS on the TravelAgency’s PDB (Travel PDB) shows the following state:

    Travel PDB:

    SELECT id, initiator, coordinator, status FROM dba_sagas;
    id initiator coordinator status

    abc123

    TravelAgency

    TACoordinator

    Initiated

    At this point, no participants have been enrolled. The Saga identifier ‘abc123’ has been assigned for the newly created Saga.

  2. This step corresponds to the participant Airline formally joining the Saga by sending an ACK to the Saga coordinator. This is handled by the Saga framework and is initiated by the join message from the Saga initiator. The Saga initiator invokes the sendRequest() call as shown in the following code segment:

    saga.sendRequest ("Airline", bookingPayload);

    The ACK is recorded at both the coordinator and participant PDBs. The following steps: 3 and 4, represent the chronological order of operations, as shown through the Saga dictionary views on the respective PDBs.

    Airline PDB (ACK initiated)

    SELECT id, participant, initiator, status FROM dba_sagas WHERE id='abc123';
    id participant initiator status

    abc123

    Airline

    TravelAgency

    Joining

  3. The travel coordinator (TACoordinator) receives the asynchronous ACK message and responds by adding the participant (Airline) to the participant set for the given Saga and sending a message in response.

    Travel Coordinator PDB (ACK received):

    SELECT id, participant, status FROM dba_saga_participant_set WHERE id='abc123';
    id participant status

    abc123

    TravelAgency

    Joined

  4. The Airline receives the ACK message from the Saga coordinator and initiates the processing of the Saga payload using its @Request annotated method: handleTravelAgencyRequest().

    Airline PDB (ACK complete):

    SELECT id, participant, initiator, status FROM dba_sagas WHERE id='abc123';
    id participant initiator status

    abc123

    Airline

    TravelAgency

    Joined

    The process of join acknowledgment is conducted using AQ messaging, propagation, and notification. The join message is enqueued at the source OUT queue (SAGA$_AIRLINE_OUT_Q1 in our example) and propagated to the Saga coordinator’s IN queue (SAGA$_TACOORDINATOR_IN_Q1) by the way of the message broker.

  5. Upon receiving a response from Airline, the initiator (TravelAgency) finalizes (commits) the Saga. The finalization process involves the following state transitions.

    Travel PDB:

    SELECT id, initiator, coordinator, status FROM dba_sagas WHERE id='abc123';
    id initiator coordinator status

    abc123

    TravelAgency

    TACoordinator

    Committed

  6. The Airline receives the commit message and initiates its own commit action. This results in the Saga transitioning from Joined to Committed on the participant PDB. The Airline sends a message to the coordinator indicating the status of its commit.

    Airline PDB:

    SELECT id, participant, initiator, status FROM dba_sagas WHERE id='abc123';
    id participant initiator status

    abc123

    Airline

    TravelAgency

    Committed

  7. The final step corresponds to the TACoordinator registering the finalization status for Airline. This is reflected in the dba_saga_participant_set view.

    Travel Coordinator PDB:

    SELECT id, participant, status FROM dba_saga_participant_set WHERE id='abc123';
    id participant status

    abc123

    TravelAgency

    Committed