Author |
Message
|
wmq_guy |
Posted: Thu Nov 11, 2004 9:42 am Post subject: WAS 5.x automate jndi objects |
|
|
Acolyte
Joined: 21 Oct 2004 Posts: 50
|
okay,
if I know the QCF and Qdest that I need to input in the admin console in WAS, cant i write some sort of script to automate this along with a MDBListener ect?
or can you only manually do this through the console?
Last edited by wmq_guy on Sat Dec 11, 2004 1:51 pm; edited 1 time in total |
|
Back to top |
|
 |
JLRowe |
Posted: Thu Nov 11, 2004 12:07 pm Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
You can script it through the wsadmin command, using the scripting languages TCL or Jython. Or, you can use the JMX interface from java code. wsadmin can also be run from an ANT script. |
|
Back to top |
|
 |
slaupster |
Posted: Wed Nov 17, 2004 2:00 am Post subject: |
|
|
Apprentice
Joined: 17 Nov 2004 Posts: 41
|
jacl to create WASQCF:
proc createWASQCF { name node server } {
global AdminConfig
# Create the connection pool setup
set CONN_TIMEOUT 1800
set MIN_CONN 1
set MAX_CONN 100
set REAP_TIME 10
set UNUSED_TIMEOUT 1800
set POOL_NAME POOLNAME
set SUB_POOL_NAME SUBPOOLNAME
set PURGE_POLICY EntirePool
set CONN_POOL "{connectionTimeout $CONN_TIMEOUT} {reapTime $REAP_TIME}"
set CONN_POOL "$CONN_POOL {minConnections $MIN_CONN} {maxConnections $MAX_CONN}"
set CONN_POOL "$CONN_POOL {unusedTimeout $UNUSED_TIMEOUT} {purgePolicy $PURGE_POLICY}"
set CONN_POOL "{$CONN_POOL}"
# ADDED by Alasdair
# set MAPPING "{{authDataAlias $alias} {mappingConfigAlias DefaultPrincipalMapping}}"
# Create the connection factory setup
set TYPE WASQueueConnectionFactory
# convert slashes to underscores for display name
# (display names with slashes do not work properly)
regsub -all "/" "$name" "_" NAME
set JNDI_NAME $name
set NODE $node
set CONNECTION_POOL $CONN_POOL
set PROVIDER [getJMSProvider "WebSphere JMS Provider" "$node" "$server"]
set PROPERTIES "{name $NAME} {jndiName $JNDI_NAME} {node $NODE}"
set PROPERTIES "$PROPERTIES {connectionPool $CONNECTION_POOL}"
# Added by Alasdair
#set PROPERTIES "$PROPERTIES {mapping $MAPPING}"
set PROPERTIES "{ $PROPERTIES }"
# Construct the command and execute
set COMMAND "$AdminConfig create $TYPE $PROVIDER $PROPERTIES"
eval $COMMAND
}
jacl to create WAS queue:
proc createWASQueue { name node server jmsServer } {
global AdminConfig
set TYPE WASQueue
# convert slashes to underscores for display name
# (display names with slashes do not work properly)
regsub -all "/" "$name" "_" NAME
set JNDI_NAME $name
set NODE $node
set JMS_SERVER $jmsServer
set PERSISTENCE APPLICATION_DEFINED
set PRIORITY APPLICATION_DEFINED
set SPECIFIED_PRIORITY 1
set EXPIRY APPLICATION_DEFINED
set SPECIFIED_EXPIRY 1
set PROVIDER [getJMSProvider "WebSphere JMS Provider" "$node" "$server"]
set PROPERTIES "{name $NAME} {jndiName $JNDI_NAME} {node $NODE} {persistence $PERSISTENCE}"
set PROPERTIES "$PROPERTIES {priority $PRIORITY} {specifiedPriority $SPECIFIED_PRIORITY}"
set PROPERTIES "$PROPERTIES {expiry $EXPIRY} {specifiedExpiry $SPECIFIED_EXPIRY}"
set PROPERTIES "{ $PROPERTIES }"
set COMMAND "$AdminConfig create $TYPE $PROVIDER $PROPERTIES"
eval $COMMAND
addQueueToJMSServer $NAME $NODE $JMS_SERVER
}
proc addQueueToJMSServer { queue {node ""} {jmsServer ""}} {
global AdminConfig
set jmsServerID $jmsServer
if { "$jmsServerID"!="" } {
# get a list of current queues
set queueNames [$AdminConfig showAttribute $jmsServerID queueNames]
# parse the semi-colon-separated string into a jacl list
set queueList [split $queueNames \;]
# make sure the specified queue is added to it
if { [lsearch $queueList $queue]==-1 } {
set queueList $queue
# join the list back together
set queueNames [join $queueList \; ]
set attrs "{queueNames $queueNames}"
set cmd "$AdminConfig modify {$jmsServerID} {$attrs}"
traceCmd $cmd
eval $cmd
} else {
# do nothing because the queue is already present
}
}
}
the main function is outside any scoping braces:
createWASQCF $node $jmsqcfName $jmsqcfJNDI $jmsqcfDescr $jmsqcfXA $authAlias |
|
Back to top |
|
 |
wmq_guy |
Posted: Sat Dec 11, 2004 1:50 pm Post subject: |
|
|
Acolyte
Joined: 21 Oct 2004 Posts: 50
|
are the commands the same for 5.0 and 5.1? |
|
Back to top |
|
 |
slaupster |
Posted: Mon Dec 13, 2004 5:44 am Post subject: |
|
|
Apprentice
Joined: 17 Nov 2004 Posts: 41
|
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 26, 2005 3:29 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
I used this method to create the JNDI resources.
I can list them using wsadmin
Code: |
wsadmin>$AdminConfig list WASQueueConnectionFactory
"Pet Store JMS Queue Connection Factory(cells/brahma/nodes/brahma/servers/server
1:resources.xml#WASQueueConnectionFactory_1)"
PlantsByWebSphereConnectionFactory(cells/brahma/nodes/brahma:resources.xml#WASQu
eueConnectionFactory_1)
SampleJMSQueueConnectionFactory(cells/brahma/nodes/brahma/servers/server1:resour
ces.xml#WASQueueConnectionFactory_2)
ivtQCF(cells/brahma/nodes/brahma:resources.xml#WASQueueConnectionFactory_2) |
I cannot see them using admin console.
Do I have to restart to see them? |
|
Back to top |
|
 |
teal |
Posted: Wed Jan 26, 2005 5:56 pm Post subject: |
|
|
 Acolyte
Joined: 15 Dec 2004 Posts: 66
|
I had a problem creating scripts one time, and when I eventually had it running correctly, I didnt see my objects in the AdminConsole either
but..within the Admin consolde, make sure it is not creating your object in a different location. i.e. CELL -NODE-SERVER
I found my in CELL, but was looking in NODE.
If that's not the case let me know. When I get to work tomorrow, I will run your wsadmin and see what's up. We can fix it.
I'm going to go post a question myself that gas me so riddled.. |
|
Back to top |
|
 |
slaupster |
Posted: Thu Jan 27, 2005 1:23 am Post subject: |
|
|
Apprentice
Joined: 17 Nov 2004 Posts: 41
|
The scope of the resources is determined by the PROVIDER variable:
set PROVIDER [getJMSProvider "WebSphere JMS Provider" "$node" "$server"]
means the resource will be created at the server scope. Teal is right, you could be looking in the wrong scope in the adminconsole, but you may well have to restart the server, or at least the adminconsole. |
|
Back to top |
|
 |
|