IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Inbound callback event notification

Callback event processing for event delivery with XA transaction

To provide data integrity and to make sure events are not delivered more than once, which would cause errors in the downstream system in the integration scenario, the invention provides a mechanism to achieve once-and-only delivery and the same is accomplished using XA transaction.

When assured delivery is required, the basic flow described in Callback event processing for basic delivery becomes more complex. For more complex scenarios, CallbackEventSender creates an instance of XA to bring the delivery under a new transaction. The beforeDevliery() call to endpoint is the starting point of XA transaction and it will last till afterDelivery(). If problems occur within this transaction scope, a proper rollback mechanism will ensure that data integrity is maintained.

XA transaction will be active and supported only when the adapter is configured with one EndpointFactory.

When the adapter signals that it has completed delivery, the transaction manager will then call "end", "prepare", and "commit" to complete the requirements outlined in the XA transaction protocol. When the "prepare" call is made, the XA implementation will call "setTransactionID" on the eventPersistance implementation; the eventPersistance implementation will store the transaction XID in the event table. When the "commit" call is made, the XA implementation will call "updateEventStatus" on the eventPersistance implementation to set the status in the event table to "COMMITED". This is done for every event that was retrieved. After all the events have been delivered to the end point successfully, they are marked "COMMITTED".

When the event is created at the EIS end, configured adapterListener gets notified and it in turn instantiates CallbackEventSender. Here adapterListener decides which method to invoke out of the four defined. Lets consider the adapter calls sendEventWithNoReturn() as shown in the sequence diagram.

Once the program control gets into CallbackEventSender, it checks how many EndpointFactories are configured for the current instance of adapter. If there is more than one, then it delivers the event by creating endpoints for each of them and invoking either onNotification or onMessage method on the endpoint without any XA transaction. Finally it would call release() method on the end point to free the endpoint hence the application server can add it to endpoint pool.

Also it invokes beforeDelivery() and afterDelivery() methods on the endpoint as defined by the JCA functional specification.

XA transaction will come into picture only when the adapter is configured with ONE EndpointFactory. The following sequence diagram depicts the callback event processing for event delivery with XA transaction.

Inbound callback event notification


Related concepts:

Request and response callback events

One-way callback events

Use the IBM WebSphere adapter foundation classes for inbound callback event processing

Callback event sender

Callback event processing for basic delivery

Callback event processing for event recovery