message listener service in websphere

ibm websphere
Below JACL script can be used to configure message listen service in IBM WAS ND 
#-----------------------------------------------------------------------------------------------
#-- Configuring message listener service 
#-----------------------------------------------------------------------------------------------

set aServer [$AdminConfig getid /Node:myNode/Server:newServer/]
set aMLService [$AdminConfig list MessageListenerService $aServer]
set alPorts [$AdminConfig showAttribute $aMLService listenerPorts]
if {[llength $alPorts] == 0} {
puts "Create a new listener port"
set nameAttr [list name myListenerPort]
set cfJNDIAttr [list connectionFactoryJNDIName jms/ connectionFactory]
set destJNDIAttr [list destinationJNDIName jms/destination]
set retriesAttr [list maxRetries 2]
set sessionAttr [list maxSessions 2]
set stateAttr [list stateManagement [list [list initialState START]]]
set attrs [list $nameAttr $cfJNDIAttr $destJNDIAttr $retriesAttr $sessionAttr $stateAttr]
set newListenerPort [$AdminConfig create ListenerPort $aMLService $attrs]
puts [$AdminConfig showall $newListenerPort]
} else {
puts "Modify existing listener ports to configure number of times to deliver the messages"
foreach alPort $alPorts {
$AdminConfig modify $alPort {{maxRetries 2}}
puts [$AdminConfig showall $alPort]
}
}

# setting up ThreadPool attributes
# inactivity time out is in number of milliseconds
set inactivityTimeoutAttr [list inactivityTimeout 1000]
set isGrowableAttr [list isGrowable true]
set maxSzAttr [list maximumSize 20]
set minSzAttr [list minimumSize 5]
set threadPoolAttrs [list $inactivityTimeoutAttr $isGrowableAttr $maxSzAttr $minSzAttr]

# get ThreadPool config object name
set threadPool [$AdminConfig showAttribute $aMLService threadPool]

# check if there is existing thread pool
if {[llength $threadPool] != 0} {
# modifying ThreadPool attribute
puts "Modify ThreadPool attributes"
$AdminConfig modify $threadPool $threadPoolAttrs
puts [$AdminConfig showall $threadPool]
} else {
# create a thread pool
puts "Create a new ThreadPool"
set threadPool [$AdminConfig create ThreadPool $aMLService $threadPoolAttrs]
puts [$AdminConfig showall $threadPool]
}

# create a new property
puts "Create a new property"
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set attrs [list $nameAttr $valueAttr]
set prop [$AdminConfig create Property $aMLService $attrs
puts [$AdminConfig showall $prop]

$AdminConfig save

#------------------------------------------------------------------------------------------
#-- Configuring Object Request Broker service 
#------------------------------------------------------------------------------------------
set aServer [$AdminConfig getid /Node:myNode/Server:newServer/]
set aORB [$AdminConfig list ObjectRequestBroker $aServer]
set connectionCacheMaxAttr [list connectionCacheMaximum 252]
set localCopiesAttr [list noLocalCopies true]
set attrs [list $connectionCacheMaxAttr $localCopiesAttr]
$AdminConfig modify $aORB $attrs
set aThreadPool [$AdminConfig showAttribute $aORB threadPool]
if {[llength $aThreadPool] == 0} {
puts "Create a new thread pool as one does not exist"
set maxSizeAttr [list maximumSize 45]
set minSizeAttr [list minimumSize 5]
set inactTimeoutAttr [list inactivityTimeout 2500]
set attrs [list $maxSizeAttr $minSizeAttr $inactTimeoutAttr]
$AdminConfig create ThreadPool $aORB $attrs
} else {
puts "Modify isGrowable attribute in existing thread pool"
$AdminConfig modify $aThreadPool {{isGrowable true}}
}
$AdminConfig save

#----------------------------------------------------------------------------------------
#-- Configuring custom properties of a server
#----------------------------------------------------------------------------------------
set aServer [$AdminConfig getid /Node:myNode/Server:newServer/]
set aAppServer [$AdminConfig list ApplicationServer $aServer]
set props [lindex [$AdminConfig showAttribute $aAppServer properties] 0]

# list all properties
if {[llength $props] != 0} {
puts "Existing properties:"
foreach aProp $props {
puts [$AdminConfig showall $aProp]
}
}

# look for property named property1
set found false
foreach aProp $props {
if {[$AdminConfig showAttribute $aProp name] == "property1"} {
set found $aProp
break
}
}

# if property1 is not found, create one
if {$found == "false"} {
puts "Create a new property"
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set attrs [list $nameAttr $valueAttr]
set prop [$AdminConfig create Property $aAppServer $attrs]
puts [$AdminConfig showall $prop]
}

$AdminConfig save

In case of any ┬ęCopyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply