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 added a OUTER_TRANSACTION_ID variable to the project's workspace.prm file.

In some instances, you may have a graph that starts an outer transaction but fails to commit it. This may happen, 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 the 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. To identify whether an outer transaction is currently running, use the listOuterTransaction operation of the Transaction Web Service.

This topic describes how to create these types of transaction graphs using the Transaction Web Service operations:
  • The Commit Transaction graph uses the commitOuterTransaction operation to end a transaction. If an outer transaction with the specified ID is in progress and if the operation succeeds, the Endeca data store 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. In the event that a running outer transaction fails, this operation lets you roll back to the previously-committed version of the index and stop the outer transaction.

To create a commit transaction or rollback transaction graph:

  1. Create an empty graph and add a WebServiceClient component.
  2. Make sure that the Endeca data store instance is running and its Administration Web Service is available by issuing a URL command (similar to the following example) from your browser. Be sure to use the correct port number of your Endeca Server (7770 in the example) and the name of the Endeca data store ("bikes" in the example).
    http://localhost:7770/ws/transaction/bikes?wsdl
    The URL command returns the WSDL of the Transaction Web service.
  3. In the Graph editor, double-click the WebServiceClient component. The Edit Component dialog is displayed.

  4. In the WSDL URL field, enter the same URL as in Step 2.
  5. In the Operation name field, click the ... browse button, which displays the Choose WS operation dialog:

  6. In the Choose WS operation dialog, select commitOuterTransaction and then click OK. For a rollback graph, you would choose the rollBackOuterTransaction operation.
  7. In the Edit Component dialog, click inside the Request structure field, which causes the ... browse button to be displayed. Then click the browse button to display an empty Edit request structure dialog.
  8. For a commit transaction operation, add this text to the Generate request field and then click OK:
    <ns:request xmlns:ns="http://www.endeca.com/MDEX/transaction/1/0">
      <ns:commitOuterTransaction>
        <ns:OuterTransactionId>${OUTER_TRANSACTION_ID}</ns:OuterTransactionId>
      </ns:commitOuterTransaction>
    </ns:request>
    For a rollback transaction operation, add this text instead:
    <ns:request xmlns:ns="http://www.endeca.com/MDEX/transaction/1/0">
      <ns:rollBackOuterTransaction>
        <ns:OuterTransactionId>${OUTER_TRANSACTION_ID}</ns:OuterTransactionId>
      </ns:rollBackOuterTransaction>
    </ns:request>
  9. Save the graph.