Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Welcome to scripting for Messaging resources > Configure messaging with wsadmin scripting


Configure the message listener service by using scripting

Use scripting to configure the message listener service.

Complete the following steps to configure the message listener service for an application server:

In the following examples, code blocks beginning with wsadmin> show code that is entered by the user. Lines that do not begin with wsadmin> show code that has been returned by the console.


Procedure

  1. Identify the application server and assign it a variable. For this example the variable is named server.

      ### Jacl

      wsadmin>set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
      

      ### Jython

      wsadmin>server = AdminConfig.getid("/Server:server1/")
      wsadmin>print server 

    Example output:

    server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1183122130078)
    

  2. Idenify the message listener service for the server and assign it to a variable. In this example the variable is named mls.

      ### Jacl

      wsadmin>set mls [$AdminConfig list MessageListenerService $server]
      

      ### Jython

      wsadmin>mls = AdminConfig.list('MessageListenerService', server)
      wsadmin>print mls
      

    Example output:

    (cells/mycell/nodes/mynode/servers/server1|server.xml#MessageListenerService_1183122130078)
    

  3. Modify various attributes with one of the following examples:

    • This example command changes the attributes of the thread pool for the message listener service:

        ### Jacl

        wsadmin>$AdminConfig modify $mls {{threadPool {{inactivityTimeout 4000}
        {isGrowable true} {maximumSize 100} {minimumSize 25}}}}
        

        ### Jython

        wsadmin>AdminConfig.modify(mls, [['threadPool', [['inactivityTimeout', 4000],
        ['isGrowable',  'true'], ['maximumSize', 100], ['minimumSize', 25]]]])
        

    • Create a listener port using the server and mls variables to provide information about the server and the message listener service:

        ### Jacl

        wsadmin>set new [$AdminConfig create ListenerPort $mls {{name my}
        {destinationJNDIName di} {connectionFactoryJNDIName jndi/fs}}]
        wsadmin>$AdminConfig create StateManageable $new {{initialState START}}
        
        

        ### Jython

        wsadmin>new = AdminConfig.create('ListenerPort',mls,[['name','myLP']
        ,['destinationJNDIName','jms/myqueue'],['connectionFactoryJNDIName','jms/myCF']])
        wsadmin>print new
        

      Example output:

      myLP(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318513831827)
      

    • Assign a variable to the 'State Manageable' property on the listener port and use it to change the initialState property on the listener port. In this example the variable is named sm.

        ### Jython

        wsadmin>sm = AdminConfig.list('StateManageable',new)
        wsadmin>print sm
        

      • Example output:
        (cells/mycell/nodes/mynode/servers/server1|server.xml#StateManageable_1318513831827)
        

        ### Jython

        wsadmin>AdminConfig.modify(sm,[['initialState','START']])
        

    • Modify a property on the first listener port on the message listener service, using jython.

      • Return a list of the listener ports on the message listener service:
        wsadmin>lports = AdminConfig.showAttribute(mls,'listenerPorts')
        wsadmin>print lports
        

        A list of the listener ports on the message listener service is returned in a string:

        myLP(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318504021702)
        myLP1(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318504495
        733) myLP2(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318513831827)]
        

      • Remove the first and last character of each listener port in the list string, so that wsadmin can use the returned information:
        wsadmin>clp = lports[1:len(lports)-1]
        wsadmin>print clp
        

        The result is returned:

        myLP(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318504021702)
        myLP1(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_13185044957
        33) myLP2(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318513831827)
        

      • Select the first listener port in the list:
        wsadmin>lport =clp.split(" ")[0]
        wsadmin>print lport
        

        Result:

        myLP(cells/mycell/nodes/mynode/servers/server1|server.xml#ListenerPort_1318504021702)
        

      • Alter a property on the listener port. In this example the maxRetries property has been altered:
        wsadmin>AdminConfig.modify(lport, [['maxRetries', 2]])
        

    • Modify a property on the first listener port on the message listener service, using jacl:
      wsadmin>set lports [$AdminConfig showAttribute $mls listenerPorts]
      wsadmin>set lport [lindex $lports 0]
      wsadmin>$AdminConfig modify $lport {{maxRetries 2}}
      

  4. Save the configuration changes.

  5. In a network deployment environment only, synchronize the node.


Use the wsadmin scripting AdminConfig object for scripted administration
Start the wsadmin scripting client using wsadmin.sh
Saving configuration changes with wsadmin.sh
Synchronize nodes using wsadmin.sh


Related


Commands for the AdminConfig object using wsadmin.sh

+

Search Tips   |   Advanced Search