End Transaction Service

The End Transaction service ends a multi-step transaction in a business process.

The following table provides an overview of the End Transaction service.

Category Description
System name End Transaction Service
Graphical Process Modeler (GPM) categories All Services
Description Ends a multi-step transaction in a business process.
Business usage Use this service to mark the end of a multi-step transaction in a business process. All of the steps that occur between the Begin Transaction service and End Transaction service are part of one transaction and are committed or rolled back at the same time. This service should be used with the Begin Transaction service.
Usage example Consider a customer ordering items online and using a shopping cart. The merchant's business process:
  1. Gets a document containing shopping cart information (customer information, product details).
  2. Inserts the customer information to the customer table.
  3. Inserts product details to the invoice table (product_id, quantity purchased).
  4. Updates the quantity of the product from the inventory table as the products were sold.
If step 4 fails (update the quantity), but steps 1 and 2 were committed. The merchant's inventory table is now inaccurate, because the items were reported as sold, but the items were not deducted from the inventory table. The Begin Transaction service and End Transaction service make it possible to have a transaction where all the steps are committed successfully or all the steps are rolled back.
Preconfigured? Yes
Requires third-party files? No
Platform availability All supported Sterling B2B Integrator platforms
Related services The End Transaction service should be used with the Begin Transaction service.
Application requirements Nothing external to Sterling B2B Integrator is required to use this service.
Initiates business processes? No
Invocation This service is invoked from a business process.
Business process context considerations No
Returned status values Returned status values:
  • 0 – Success
  • 1 – Error
Restrictions N/A
Testing considerations N/A

How the End Transaction Service Works

Use the End Transaction service to end a multi-step transaction.

Business Process Example

In the following business process example, an online shopping cart is featured. The business process:
  1. Gets a document containing shopping cart information (customer information, product details).
  2. Inserts the customer information to the customer table.
  3. Inserts product details to the invoice table (product_id, quantity purchased).
  4. Updates the quantity of the product from the inventory table as the products are sold.

For example, if step 4 fails (update the quantity), but steps 1 and 2 were committed. The merchant's inventory table is now inaccurate, because the items were reported as sold, but the items were not deducted from the inventory table. The Begin Transaction service and End transaction service make it possible to have a transaction where all the steps are committed successfully or all the steps are rolled back.

<process name="TestTran">
  <sequence>
    <operation name="Begin">
      <participant name="BeginTransactionService"/>
      <output message="Xout">
        <assign to="START_TRANSACTION">TRUE</assign>
        <assign to="DISTRIBUTED">TRUE</assign>
      </output>
      <input message="Xin">
        <assign to="." from="*"></assign>
      </input>
    </operation>
    <operation name="XML Encoder">
       <participant name="XMLEncoder"/>
      <output message="XMLEncoderTypeInputMessage">
        <assign to="output_to_process_data">YES</assign>
        <assign to="root_element">root</assign>
        <assign to="mode">xml_to_process_data</assign>
        <assign to="." from="*"></assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
    <operation name="LightweightJDBCAdapterType">
      <participant name="LightweightJDBCAdapterQuery"/>
      <output message="LightweightJDBCAdapterTypeInputMessage">
        <assign to="schedHour">-1</assign>
        <assign to="result_name">result</assign>
        <assign to="schedDay">-2</assign>
        <assign to="sql">INSERT INTO CUSTOMER_LW (CUSTOMER_ID,
              SIR_NAME, FIRST_NAME, MIDDLE_INITIAL, LAST_NAME, ADDRESS, CITY,
               STATE, ZIP, PHONE_NUM, EMAIL, ORDERS_PLACED, EMPLOYER, 
               WORK_PHONE, WORK_EMAIL, WORK_ADDRESS1, WORK_ADDRESS2, 
               WORK_CITY, WORK_STATE, WORK_ZIP) VALUES
               (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
                </assign>
        <assign to="param1" from="Testplan/Test4/Customer_ID/text()"></assign>
        <assign to="paramtype1">Integer</assign>
        <assign to="param2" from="Testplan/Test4/SirName/text()"></assign>
        <assign to="paramtype2">String</assign>
        <assign to="param3" from="Testplan/Test4/FirstName/text()"></assign>
        <assign to="paramtype3">String</assign>
        <assign to="param4" from="Testplan/Test4/MiddleInitial/text()"></assign>
        <assign to="paramtype4">String</assign>
        <assign to="param5" from="Testplan/Test4/LastName/text()"></assign>
        <assign to="paramtype5">String</assign>
        <assign to="param6" from="Testplan/Test4/Address/text()"></assign>
        <assign to="paramtype6">String</assign>
        <assign to="param7" from="Testplan/Test4/City/text()"></assign>
        <assign to="paramtype7">String</assign>
        <assign to="param8" from="Testplan/Test4/State/text()"></assign>
        <assign to="paramtype8">String</assign>
        <assign to="param9" from="Testplan/Test4/Zip/text()"></assign>
        <assign to="paramtype9">String</assign>
        <assign to="param10" from="Testplan/Test4/Phone_Num/text()"></assign>
        <assign to="paramtype10">String</assign>
        <assign to="param11" from="Testplan/Test4/Email/text()"></assign>
        <assign to="paramtype11">String</assign>
        <assign to="param12" from="Testplan/Test4/Orders_Placed/text()"></assign>
        <assign to="paramtype12">Integer</assign>
        <assign to="param13" from="Testplan/Test4/Employer/text()"></assign>
        <assign to="paramtype13">String</assign>
        <assign to="param14" from="Testplan/Test4/Work_Phone/text()"></assign>
        <assign to="paramtype14">String</assign>
        <assign to="param15" from="Testplan/Test4/Work_Email/text()"></assign>
        <assign to="paramtype15">String</assign>
        <assign to="param16" from="Testplan/Test4/Work_Address1/text()"></assign>
        <assign to="paramtype16">String</assign>
        <assign to="param17" from="Testplan/Test4/Work_Address2/text()"></assign>
        <assign to="paramtype17">String</assign>
        <assign to="param18" from="Testplan/Test4/Work_City/text()"></assign>
        <assign to="paramtype18">String</assign>
        <assign to="param19" from="Testplan/Test4/Work_State/text()"></assign>
        <assign to="paramtype19">String</assign>
        <assign to="param20" from="Testplan/Test4/Work_Zipcode/text()"></assign>
        <assign to="paramtype20">String</assign>
        <assign to="pool">mysqlPool</assign>
        <assign to="row_name">row</assign>
        <assign to="schedMinute">-1</assign>
        <assign to="query_type">ACTION</assign>
        <assign to="." from="*"></assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
    <operation name="LightweightJDBCAdapterType">
      <participant name="LightweightJDBCAdapterQuery"/>
      <output message="LightweightJDBCAdapterTypeInputMessage">
        <assign to="schedHour">-1</assign>
        <assign to="result_name">result</assign>
        <assign to="schedDay">-2</assign>
        <assign to="sql">INSERT INTO INVOICE CUSTOMER_ID,PRODUCT_ID,QTY) VALUES
                    (?, ?, ?) </assign>
        <assign to="param1" from="Testplan/Test4/Customer_ID/text()"></assign>
        <assign to="paramtype1">Integer</assign>
        <assign to="param2" from="Testplan/Test4/PRODUCT_ID/text()"></assign>
        <assign to="paramtype2">String</assign>
        <assign to="param3" from="Testplan/Test4/QUANTITY/text()"></assign>
        <assign to="paramtype3">Integer</assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
    <operation name="LightweightJDBCAdapterType">
      <participant name="LightweightJDBCAdapterQuery"/>
      <output message="LightweightJDBCAdapterTypeInputMessage">
        <assign to="schedHour">-1</assign>
        <assign to="result_name">result</assign>
        <assign to="schedDay">-2</assign>
        <assign to="sql">INSERT INTO PRODUCT QTY VALUES (?) WHERE PRODUCT_ID=? 
            </assign>
        <assign to="param1" from="Testplan/Test4/QUANTITY/text()"></assign>
        <assign to="paramtype2">Integer</assign>
        <assign to="param3" from="Testplan/Test4/PRODUCT_ID/Text()"></assign>
        <assign to="paramtype3">String</assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
    <operation>
      <participant name="EndTransactionService"/>
      <output message="Xout">
        <assign to="END_TRANSACTION">TRUE</assign>
      </output>
      <input message="Xin">
        <assign to="." from="*"></assign>
      </input>
    </operation>
  </sequence> 
</process>

Implementing the End Transaction Service

To implement the End Transaction service for use in a business process:

  1. Use the End Transaction service in a business process.
  2. Use the Begin Transaction service to begin the transaction.

Output from Business Process to Service

The following table contains the parameter passed from the business process to the End Transaction service:

Parameter Description
End_Transaction Ends the transaction. Valid value is true (default) or false. Required.
Rollback_Transaction Sets the transaction to rollback. Valid value is true or false (default). Optional. Business process logic may be used to determine that a transaction should not be committed. By calling an instance of this service with this parameter set to “TRUE”, the transaction can be rolled back.