May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Setting the XA Transaction timeout values for a datasource through WLST script

This post explain the approach to set some of the important timeout properties for XA datasources through WLST script.

Set XA Transaction Timeout:
Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.

When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA Transaction Timeout value or the global transaction timeout.

XA Transaction Timeout:
The number of seconds to set as the transaction branch timeout.
If set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.

When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.

If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.

XA Retry Duration:
Determines the duration in seconds for which the transaction manager will perform recover operations on the resource. A value of zero indicates that no retries will be performed.

XA Retry Interval:

The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.

SetXATimeoutProperties.py

def setXATimeoutProperties():
dsName=’SOADataSource’
edit()
startEdit()
 
server=’AdminServer’
cd(“Servers/”+server)
target=cmo
 
print ‘=========================================’
print ‘Setting the timeout properties for DataSource….’
print ‘=========================================’   
 
cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaSetTransactionTimeout(true)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaTransactionTimeout(3000)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaRetryDurationSeconds(300)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaRetryIntervalSeconds(60)

save()
activate()

print ‘Timeout settings for the datasource ‘+dsName+’ has been completed’
 
 
def main():
 
adminURL=’t3://10.30.34.216:8000′
adminUserName=’weblogic’
adminPassword=’reuters123′
connect(adminUserName, adminPassword, adminURL)
setXATimeoutProperties()
disconnect()

 

main()

Execute the script:
cd %WLS_HOME%\common\bin
wlst.sh SetJDBCTimeoutProperties.py

Restart the server after successful execution.

weblogicssrrerew-6

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>