+

Search Tips   |   Advanced Search

Set the runtime transaction service using scripting


Use wsadmin to configure transaction properties for servers. The transaction service is a server runtime component that coordinates updates to multiple resource managers to ensure atomic updates of data. Transactions are started and ended by applications or the container in which the applications are deployed.

There are two ways to perform this task. Use the steps in this task to use AdminControl to modify the transaction service configuration. Alternatively, we can use the configureTransactionService Jython script in the AdminServerManagement script library to configure the transaction service configuration attributes. Use the configureRuntimeTransactionService to update the transaction service MBean attributes. The wsadmin tool automatically loads the scripts when the tool starts. Use the following syntax to configure transaction service settings using configureTransactionService script:

AdminServerManagement.configureTransactionService(nodeName, serverName, totalTranLifetimeTimeout, clientInactivityTimeout, maximumTransactionTimeout, heuristicRetryLimit, heuristicRetryWait, propogateOrBMTTranLifetimeTimeout, asyncResponseTimeout, otherAttributeList)

Use the following syntax to configure runtime transaction service settings using configureRuntimeTransactionService script:

AdminServerManagement.configureRuntimeTransactionService(nodeName, serverName, totalTranLifetimeTimeout, clientInactivityTimeout)

For additional information and argument definitions, see the documentation for the AdminServerMananagment script library.

 

  1. Identify the transaction service MBean for the appserver.

    Use the completeObjectName command for AdminControl to return the transaction service MBean for the server1 server, and to set it to the ts variable, as the following example demonstrates:

    • Jacl...

      set ts [$AdminControl completeObjectName cell=mycell,node=mynode, process=server1,type=TransactionService,*]
    • Jython...

      ts = AdminControl.completeObjectName('cell=mycell,node=mynode, process=server1,type=TransactionService,*')
      print ts

    The following table shows the elements in the previous commands.


    Table 1. Elements in the completeObjectName command

    Element Description
    set A Jacl command
    ts A variable name
    $ A Jacl operator for substituting a variable name with its value
    AdminControl An object that enables the manipulation of MBeans running in a server process
    completeObjectName An AdminControl command

    cell=mycell,node=mynode,process=server1,type=TransactionService
    
    A fragment of the object name whose complete name is returned by this command. It is used to find the matching object name which is, in this case, the transaction object MBean for the node mynode, where mynode is the name of the node that you use to synchronize configuration changes. For example: type=TransactionService, process=server1. It can be any valid combination of domain and key properties, for example, type, name, cell, node, and process.

    For example...

    WebSphere:cell=mycell,name=TransactionService,mbeanIdentifier=TransactionService, type=TransactionService,node=mynode,process=server1
    

  2. Modify the runtime transaction service configuration attributes.

    • Jacl...

      $AdminControl setAttributes $ts {{clientInactivityTimeout 30} 
      {totalTranLifetimeTimeout 180}}
      
    • Jython...

      AdminControl.setAttributes(ts, [['clientInactivityTimeout', 30], ['totalTranLifetimeTimeout', 180]])
      

    The following table shows the elements in the previous commands.


    Table 2. Elements in the setAttributes command

    Element Description
    $ Jacl operator for substituting a variable name with its value
    AdminControl An object that enables the manipulation of MBeans running in a server process
    setAttributes An AdminControl command
    ts Evaluates to the ID of the transaction service of interest
    clientInactivityTimeout An attribute
    30 The value of the clientInactivityTimeout attribute specified in seconds. A value of 0 means that there is no timeout limit.
    totalTranLifetimeTimeout An attribute
    180 The value of the totalTranLifetimeTimeout attribute specified in seconds. A value of 0 means that there is no timeout limit.


Set the WS-Transaction spec level using wsadmin

 

Related tasks


Set transaction properties for an appserver
Automating server administration using the scripting library
Use AdminControl for scripted administration

 

Related


Node administration scripts
Server settings configuration scripts
Transaction service settings
Commands for AdminControl