Browse Prior Art Database

A mechanism for defining a compensation action for an enterprise bean by that enterprise bean

IP.com Disclosure Number: IPCOM000020386D
Original Publication Date: 2003-Nov-19
Included in the Prior Art Database: 2003-Nov-19
Document File: 2 page(s) / 47K

Publishing Venue

IBM

Abstract

A mechanism for an Enterprise JavaBean* to define how its actions can be compensated if it participates in a business process that uses the compensation patterns.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 54% of the total text.

Page 1 of 2

A mechanism for defining a compensation action for an enterprise bean by that enterprise bean

Disclosed is an extension to the deployment description of an Enterprise JavaBean (EJB*) to allow that EJB to define how its actions can be compensated by a business process using the compensation design pattern. The new deployment descriptors describe pairings between method calls. One method call is used as the primary or forward method, i.e., the method used during normal operation of the EJB. The second method is the compensation method, which will be invoked by the application server if the primary method needs to be compensated.

    When an application consists of multiple transactions, changes that are committed by one part of the application and then need to undone must either explicitly undo the changes or use a compensation service to record and run undo actions when required. Existing compensation services require use of their own mechanisms to define the compensation actions (For example by using compensation handlers (as in BPEL4WS (Business Process Execution Language for Web Services)). These existing mechanisms require the compensation actions to be defined as Web Services and to provide application level compensation actions. For EJB applications these mechanisms are heavyweight and are very unnatural.

    By extending the deployment description of the EJB to provide the definition of a compensation method to be invoked if the caller's transaction rolls back, and by extended the application server to understand the extended deployment descriptor, the EJB can participate in the compensation service and be invoked by that compensation service as required by any compensation.

    An example of such an extended deployment descriptor that defines the compensation behavior of an EJB contained within an enterprise application is:

<compensation-definitions>

<compensation-group id="comp1">

<ejb-name>ProcessPayment</ejb-name> <primary-method>

             <primary-method-name>ByCash</primary-method-name> <primary-method-param id="Customer">CustomerRemote</primary-method-param>

             <primary-method-param id="amount">double<primary-method-param> </primary-method> <primary-method>

             <method-name>ByCheck</method-name> <primary-method-param id="Customer">CustomerRemote</primary-method-param>

             <primary-method-param id="checkDo">CheckDO</primary-method-param>

             <primary-method-param id="amount">double</primary-method-param> </primary-method> <primary-method>

<method-name>ByCreditCard</method-name> <primary-method-param

Page 2 of 2

id="Customer">CustomerRemote</primary-method-param>

             <primary-method-param id="creditDo">CreditDO</primary-method-param>

             <primary-method-param id="amount">double<primary-method-param> </primary-method> <compensation-method>

             <method-name>refund</method-name> </compens...