Script To Manage JMS in websphere

ibm websphere
Below JACL script can be used to manage the JMS in websphere application  server.
#--------------------------------------------------------------------------
#-- Manage JMS Servers (WebSphere Application Server Network Deployment
#-- Listing JMS servers 
#--------------------------------------------------------------------------
set jmsServers [$AdminConfig list /Server:jmsserver/]
  puts "There are [llength $jmsServers] JMS servers:"
  foreach aJmsServer $jmsServers {
     puts $aJmsServer
  }
#--------------------------------------------------------------------------
#-- Starting JMS servers
#--------------------------------------------------------------------------
set jmsServers [$AdminConfig getid /Server:jmsserver/]
foreach aJmsServer $jmsServers {
# identify server name
set serverName [$AdminConfig showAttribute $aJmsServer name]
# identify node name
set exp {(["A-Z_a-z0-9\(/ ]+)/nodes/(["A-Z_a-z0-9 ]+)/servers/([A-Z_a-z0 -9\)/#: ]+)} regexp $exp $aJmsServer junk junk2 nodeName
$AdminControl startServer $serverName $nodeName
}

#---------------------------------------------------------------------------
#--Stopping JMS servers 
#---------------------------------------------------------------------------

set jmsServers [$AdminControl queryNames type=Server,name=jmsserver,*]
foreach aJmsServer $jmsServers {
# identify node name
set nodeName [$Admintrol getAttribute $aJmsServer nodeName]
$AdminControl stopServer jmsserver $nodeName
}

#----------------------------------------------------------------------
#--Configuring general properties of a JMS server 
#---------------------------------------------------------------------

set aJmsServer [$AdminConfig getid /Node:myNode/Server:myServer/JMSServer:/]
if {[llength $aJmsServer] != 0} {
# modify general properties
puts "Modify general properties of JMS server $aJmsServer'
set descAttr [list description "JMSServer description"]
set numThreadAttr [list numThreads 8]
set qNamesAttr [list queueNames {JMSQueue1;JMSQueue2}]
set attrs [list $descAttr $numThreadAttr $qNamesAttr]
$AdminConfig modify $aJmsServer $attrs
puts [$AdminConfig show $aJmsServer]

$AdminConfig save
}

#---------------------------------------------------------------------
#--Configuring security port end point of a JMS server 
#----------------------------------------------------------------------

set aJmsServer [$AdminConfig getid /Node:myNode/Server:myServer/JMSServer:/]
if {[llength $aJmsServer] != 0} {
# get configuration object name for securityPort
set secPort [$AdminConfig showAttribute $aJmsServer securityPort]
# modify the endpoint
puts "Modify security port endpoint"
puts "existing values: [$AdminConfig show $secPort]"

set hostAttr [list host myhost]
set portAttr [list port 5555]
set attrs [list $hostAttr $portAttr]
$AdminConfig modify $secPort $attrs
puts "new values: [$AdminConfig show $secPort]"

$AdminConfig save
}

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.