Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Transactional Client Processing with Adapters | Using Transaction Processing | Beginning a Transaction | Ending a Transaction
 
Ending a Transaction
Ending a transaction can involve a COMMIT, ROLLBACK, or SAVEPOINT operation. Use the awEndTransaction method to end the transaction. This function requires the following parameters:
*The transaction identifier.
*The mode, which should be either TRANSACTION_MODE_COMMIT, TRANSACTION_MODE_SAVEPOINT, or TRANSACTION_MODE_ROLLBACK.
*An area where a tag field can be returned. If your Broker client does not wish to receive an acknowledgment event for the Adapter::endTransaction event that is to about be published, this parameter should set to NULL.
Note:
Requesting a SAVEPOINT operation will return an error event if the adapter's transaction level does not support save points, but the transaction will remain open.
If the reply_tag parameter is not NULL, an acknowledgment will be sent for the Adapter::endTransaction event. The tag field will be set in reply_tag so that your application can correlate the acknowledgment event you receive with the Adapter::endTransaction event that was published.
The following example illustrates how to invoke the function:
BrokerClient c;
BrokerError err;
char **transId;
int transTag;
. . .
// Obtain a transaction id.
. . .
// end the transaction
err = awEndTransaction( c, transId, TRANSACTION_MODE_COMMIT,
&transTag);
if (err != AW_NO_ERROR) {
printf("Error ending transaction\n%s\n",
awErrorToString(err));
return 0;
}
. . .