Committing or rolling back an outer transaction

You can build graphs that commit or roll back an outer transaction that failed to commit successfully.

This procedure assumes that you have followed the recommended practice described earlier. Specifically, this procedure assumes you have specified the OUTER_TRANSACTION_ID global variable as empty in the project's workspace.prm file and have used that global variable in the components in your project.

In some instances, a graph that starts an outer transaction may fail to commit the transaction. An uncommitted transaction may occur, for example, when you are creating a new graph and troubleshooting its sub-graphs. If any of the sub-graphs fail, the entire graph running an outer transaction may fail also.

Since only one outer transaction can be in progress at a time, if a graph running an outer transaction fails, you cannot run any other graphs that start outer transactions until the outer transaction that is in progress is committed. In such cases, you can commit an outer transaction manually.

Typically, you may need to close an already running outer transaction after you receive a transaction-related error, when trying to run one of your graphs. If you have followed recommended practice, the outer transaction will be running with an ID of "transaction".

This topic describes how to create graphs that either commit or roll back a running transaction using operations of the Transaction Web Service:
  • A Commit Transaction graph uses the commitOuterTransaction operation to end a transaction. If an outer transaction with the specified ID (usually "transaction") is in progress and if the operation succeeds, the Endeca data domain commits the changes to the index made within this outer transaction, and starts processing unqualified queries and updates against this version of the index.
  • The Rollback Transaction graph uses the rollBackOuterTransaction operation to roll back an outer transaction. If a running outer transaction fails, use this operation to roll back to the previously-committed version of the index and stop the transaction.

Before running a commit or rollback transaction graph, confirm that the data domain instance is running and that the Transaction Web Service is available by issuing a URL command from your browser, similar to the following example. Be sure to use the correct port number of your Endeca server (7770 by default) and the name of the Endeca data domain ("bikes" in the following example).

http://localhost:7770/ws/transaction/bikes?wsdl

To create a commit transaction or rollback transaction graph:

  1. Create an empty graph and add a WebServiceClient component.
  2. Edit the Web Service Client.
    1. In the WSDL URL field, specify the URL of the Transaction Web Service as illustrated above. Remember to use the port and data store of your implementation.
    2. In the Operation name field, choose either commitOuterTransaction or rollbackOuterTransaction.
    3. Access the Edit request structure dialog and in the Generate request field, enter one of the following code blocks (Note: The following code assumes you are following recommended practice.):

      For a Commit Transaction graph:

      <ns:request xmlns:ns="http://www.endeca.com/MDEX/transaction/1/0">
        <ns:commitOuterTransaction>
          <ns:OuterTransactionId>transaction</ns:OuterTransactionId>
        </ns:commitOuterTransaction>
      </ns:request>

      For a Rollback Transaction graph

      <ns:request xmlns:ns="http://www.endeca.com/MDEX/transaction/1/0">
        <ns:rollBackOuterTransaction>
          <ns:OuterTransactionId>transaction</ns:OuterTransactionId>
        </ns:rollBackOuterTransaction>
      </ns:request>
  3. Save the graph.