Configure transaction properties for a server using scripting

 

Configure transaction properties for a server using scripting

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

Perform the following steps to configure the runtime transaction properties for an application server.

  1. Identify the transaction service MBean for the application server. The following command returns the transaction service MBean for server1.

    • Using Jacl:
      set ts [$AdminControl completeObjectName cell=mycell,node=mynode,process=server1,type=TransactionService,*]

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

    where:

    set is a Jacl command
    ts is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
    completeObjectName is an AdminControl command
    cell=mycell,node=mynode,process=server1,type=TransactionService is 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, process, etc.
    Example output:

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

  2. Modify the attributes.

    • Using Jacl:
      $AdminControl setAttributes $ts {{clientInactivityTimeout 30} {totalTranLifetimeTimeout 180}}

    • Using Jython:
      AdminControl.setAttributes(ts, [['clientInactivityTimeout', 30],  ['totalTranLifetimeTimeout', 180]])

    where:

    $ is a Jacl operator for substituting a variable name with its value
    AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
    setAttributes is an AdminControl command
    ts evaluates to the ID of the transaction service specified in step number 1
    clientInactivityTimeout is an attribute
    30 is the value of the clientInactivityTimeout attribute specified in seconds. A value of 0 means that there is no timeout limit.
    totalTranLifetimeTimeout is an attribute
    180 is the value of the totalTranLifetimeTimeout attribute specified in milliseconds. A value of 0 means that there is no timeout limit.




Related concepts
AdminControl object for scripted administration

Related reference
Commands for the AdminControl object