WAS 6.1, RSA 7.0.0.6
Create a py file in the project, e.g. a script to create a SIB bus, add member to the bus, create a Queue Connection Factory, and a few queues could look like,
Right click on the py file, and select Run As, then Administrative Script.from java.lang import String
from java.util import Properties
from com.ibm.ws.scripting import ScriptingException
from java.io import File
from java.io import FileOutputStream
from java.io import FileInputStream
from java.io import PrintStream
###################################################################################
# Verify input parameters
#
###################################################################################
# Usage method
def usage():
print ""
print "Usage to create local sib resources:"
print "wsadmin -profileName-lang jython -f create_local_sib.py "
print "Example: wsadmin -profileName AppSrv01 -lang jython -f create_local_sib.py Cell Node server1"
print ""
print "NOTE: This script creates the 'bus', addsas member to the bus,"
print " the Queue Connection Factory and queues on the bus."
print " This is a pure CREATE script. It does not check whether resources already exist."
print " The script will fail if any of the SIB resources already exist."
sys.exit()
# Update these to reflect local environment
m_cellName = ""
m_nodeName = ""
m_serverName = ""
# Get the cell parameter
try:
m_cellName = sys.argv[0]
except:
print "You must specify a Cell name"
usage()
# Get the node parameter
try:
m_nodeName = sys.argv[1]
except:
print "You must specify a Node name"
usage()
# Get the server parameter
try:
m_serverName = sys.argv[2]
except:
print "You must specify a Server name"
usage()
# Configure the Bus and Server
AdminTask.createSIBus('[-bus bus -busSecurity false -scriptCompatibility 6.1 ]')
# File Store Bus Member
AdminTask.addSIBusMember('[-bus bus -node ' + m_nodeName + ' -server ' + m_serverName + ' -fileStore -logSize 100 -minPermanentStoreSize 200 -maxPermanentStoreSize 500 -unlimitedPermanentStoreSize false -minTemporaryStoreSize 200 -maxTemporaryStoreSize 500 -unlimitedTemporaryStoreSize false ]')
print "Bus created and Bus member added."
# Create the Queue Connection Factory
AdminTask.createSIBJMSConnectionFactory(m_serverName + '(cells/' + m_cellName + '/nodes/' + m_nodeName + '/servers/' + m_serverName + '|server.xml)', '[-name ossQueueConnectionFactory -jndiName jms/ossQueueConnectionFactory -type queue -authDataAlias -category -description -xaRecoveryAuthAlias -busName ossBus -nonPersistentMapping ExpressNonPersistent -persistentMapping ReliablePersistent -readAhead Default -target -targetType BusMember -targetSignificance Preferred -targetTransportChain -providerEndPoints -connectionProximity Bus -tempQueueNamePrefix -shareDataSourceWithCMP false]')
print "Queue Connection Factory created."
def createQueue(sibQueueName, jmsQueueName, activationSpecName, isSingleton, queuePriority):
concurrencyParam = ""
if isSingleton == 1:
concurrencyParam = " -maxConcurrency 1 "
poisonMessageParams = ""
if sibQueueName != "QUEUE1":
poisonMessageParams = " -maxFailedDeliveries 1 -exceptionDestination QUEUE1 "
AdminTask.createSIBDestination('[-bus bus -name ' + sibQueueName + ' -type Queue -node ' + m_nodeName + ' -server ' + m_serverName + ' -description -reliability ASSURED_PERSISTENT ' + poisonMessageParams + ']')
AdminTask.createSIBJMSQueue(m_serverName + '(cells/' + m_cellName + '/nodes/' + m_nodeName + '/servers/' + m_serverName + '|server.xml)', '[-name ' + jmsQueueName + ' -jndiName jms/' + jmsQueueName + ' -description -queueName ' + sibQueueName + ' -deliveryMode Application -priority ' + queuePriority + ' -readAhead AsConnection -busName bus ]')
AdminTask.createSIBJMSActivationSpec(m_serverName + '(cells/' + m_cellName + '/nodes/' + m_nodeName + '/servers/' + m_serverName + '|server.xml)', '[-name ' + activationSpecName + ' -jndiName jms/' + activationSpecName + ' -destinationJndiName jms/' + jmsQueueName + ' -description -acknowledgeMode Auto-acknowledge -authenticationAlias -busName bus -clientId -durableSubscriptionHome ' + concurrencyParam + ' -messageSelector -subscriptionDurability NonDurable -subscriptionName -readAhead Default -target -targetType BusMember -targetSignificance Preferred -targetTransportChain -shareDataSourceWithCMP false]')
createQueue("QUEUE0", "description", "ExceptionActivationSpecifications", 0, "9")
createQueue("QUEUE1", "description", "ActivationSpecifications", 0, "4")
createQueue("QUEUE2", "description", "ActivationSpecifications", 0, "4")
createQueue("QUEUE3", "description", "ActivationSpecifications", 1, "4")
createQueue("QUEUE4", "description", "ActivationSpecifications", 0, "4")
createQueue("QUEUE5", "description", "ActivationSpecifications", 1, "4")
createQueue("QUEUE6", "description", "AsyncResponseSpecifications", 0, "4")
print "Queues created."
AdminConfig.save()
print "Finished."
Select WebSphere Application Server v6.1 as the Scripting runtime.
Select AppSrvWSFP01 as the WebSphere profile.
Enter Cell Node Server as the wasadmin arguments.
Select Specify in the Security and enter userid and password
Click on Run to run the script.
3 comments:
Hi,
The python script is partially not visible ..... may be due to formatting problem in blog. Actually I was looking for similar script over the internet and I stumbled upon you blog. I must say I found it quite enriching. Can you please post the properly Python script file again which will be very helpful;l for me.
Regards
Soumya
Soumya,
Actually you can simply copy and paste them into a text file.
Thank you for visiting,
Thomas
Thanks Thomas I am able to copy the content.
Post a Comment