Tuesday, April 13, 2010

JCA Resource Adapter transaction management in BPEL

The JCA Resource Adapter can support transactions on systems with a BPEL client. When designing your BPEL processes, keep the following in mind:

  • A good practice is to define a scope within BPEL processes where a sequence of opcodes called with a transaction are executed, and to add a catch block in this scope and call abort if any error occurs.
  • The BPEL processes must abort all open transactions when any exception occurs, except for CommException. The JCA Resource Adapter throws CommException when the Portal Context closes or errors out but the transaction cannot be aborted.
  • The transaction operations described in the base Web service must not be used in a BPEL section that can trigger process hibernation or parallel processing. Those transaction operations must be in a BPEL section that performs synchronous invoke.

Note

The JCA Resource Adapter does not support nested transactions.

To set up JCA Resource Adapter transaction management in BPEL, perform the following:

  • In the BPEL client, set these BPEL partnerLink properties:
  • cacheConnections=false

When set to “false”, it releases connection right after completing the unit of work, and connection is available to OC4J connection pool.

  • useJCAConnectionPool=true

If we set this to true then it will ensures single threading through JCA LocalTransactions.

  • In the JCA Resource adapter, create a private connection pool for the connection factory.

Example :
1. Connection Pooling Scheme : Dynamic
2. Maximum Connections : 200
3. Minimum Connection : 50
4. Fixed Wait Timeout : 0

5. Expired Connection Cleanup: Periodically
6. Inactive Connection Timeout: 300

Maximum Connection= dm_n_fe * dm_max_per_fe

dm_n_fe and dm_max_per_fe entries in dm_oracle pin.conf. Increase the values if required.

You encounter the following exception when the above steps are not performed properly or when one of the BPEL processes fails to close a transaction.

§ java.lang.IllegalStateException: New ManagedConnection cannot be created for a thread which is already in BRM transaction

§ Adapter Framework unable to create outbound JCA connection.

1 comment:

  1. Good post, facing the same problem .. lets see if it works.

    ReplyDelete