ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » WAS 5.x automate jndi objects

Post new topic  Reply to topic
 WAS 5.x automate jndi objects « View previous topic :: View next topic » 
Author Message
wmq_guy
PostPosted: Thu Nov 11, 2004 9:42 am    Post subject: WAS 5.x automate jndi objects Reply with quote

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
View user's profile Send private message
JLRowe
PostPosted: Thu Nov 11, 2004 12:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
slaupster
PostPosted: Wed Nov 17, 2004 2:00 am    Post subject: Reply with quote

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
View user's profile Send private message
wmq_guy
PostPosted: Sat Dec 11, 2004 1:50 pm    Post subject: Reply with quote

Acolyte

Joined: 21 Oct 2004
Posts: 50

are the commands the same for 5.0 and 5.1?
Back to top
View user's profile Send private message
slaupster
PostPosted: Mon Dec 13, 2004 5:44 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2004
Posts: 41

yeah they are
Back to top
View user's profile Send private message
vennela
PostPosted: Wed Jan 26, 2005 3:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
teal
PostPosted: Wed Jan 26, 2005 5:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
slaupster
PostPosted: Thu Jan 27, 2005 1:23 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » WAS 5.x automate jndi objects
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.