Monday, March 4, 2013

Setting up the JMS resources through WLST script



The below WLST script help us to set up the JMS resources.

JMSConpiguration.py

connect('weblogic','weblogic', 't3://localhost:8000')

edit()
startEdit()

print 'Creating File Store'
cd('/')
cmo.createFileStore('BAMMonitoringJMSFileStore')
cd('/FileStores/BAMMonitoringJMSFileStore')
cmo.setDirectory('BAMMonitoringJMSFileStore')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))


print 'Creating JMS Server'
cd('/')
print 'Creating JMS Server.'
cmo.createJMSServer('BAMMonitoringServer')
cd('/JMSServers/BAMMonitoringServer')
cmo.setPersistentStore(getMBean('/FileStores/BAMMonitoringJMSFileStore'))
cmo.setTemporaryTemplateResource(None)
cmo.setTemporaryTemplateName(None)
cmo.addTarget(getMBean('/Servers/AdminServer'))

print 'Creating JMS Module'
cd('/')
cmo.createJMSSystemResource('BAMJMSSystemResource')
cd('/JMSSystemResources/BAMJMSSystemResource')
cmo.addTarget(getMBean('/Servers/AdminServer'))
cmo.createSubDeployment('BAMSubdeDloyment')

print 'Creating Connection Factory'
cd('/')
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource')
cmo.createConnectionFactory('BAMMonitoringConnectionfactory')
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/ConnectionFactories/BAMMonitoringConnectionfactory')
cmo.setJNDIName('jms/BAMMonitoringConnectionfactory')
#set('SubDeploymentName','BAMSubdeDloyment')
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/ConnectionFactories/BAMMonitoringConnectionfactory/SecurityParams/BAMMonitoringConnectionfactory')
cmo.setAttachJMSXUserId(false)
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/ConnectionFactories/BAMMonitoringConnectionfactory/ClientParams/BAMMonitoringConnectionfactory')
cmo.setClientIdPolicy('Restricted')
cmo.setSubscriptionSharingPolicy('Exclusive')
cmo.setMessagesMaximum(10)
#cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/ConnectionFactories/BAMMonitoringConnectionfactory/TransactionParams/BAMMonitoringConnectionfactory')
#cmo.setXAConnectionFactoryEnabled(true)
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/ConnectionFactories/BAMMonitoringConnectionfactory')
cmo.setDefaultTargetingEnabled(true)

print 'Creating Queue'
cd('/')
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource')
cmo.createQueue('BAMMonitoringQueue')
cd('/JMSSystemResources/BAMJMSSystemResource/JMSResource/BAMJMSSystemResource/Queues/BAMMonitoringQueue')
set('JNDIName','jms/BAMMonitoringQueue')
set('SubDeploymentName','BAMSubdeDloyment')
cd('/JMSSystemResources/BAMJMSSystemResource/SubDeployments/BAMSubdeDloyment')
cmo.addTarget(getMBean('/JMSServers/BAMMonitoringServer'))

print 'JMS Resources are Successfully Created'
activate()

Executing the script:

Set the environment by executing the below script
$WL_Home/wlserver_10.3/server/bin/setWLSEnv.sh
Execute JMSConpiguration.py
Wlst.sh JMSConpiguration.py

1 comment:

  1. Nice post on JMS Resource creation.

    I have just tried same but on Basic WebLogic domain by breaking the task into two parts: 1. JMSServer creation and 2. JMS Module creation.

    Have a look on this.
    http://wlstbyexamples.blogspot.in/2013/01/jms-configuration-using-wlst.htm

    ReplyDelete