Monday, June 8, 2009

Python to create 2 JMS Queues complete of JMSServer

replace pvserver with yourserver


cd('/')
cmo.createFileStore('FileStore-0')

cd('/Deployments/FileStore-0')
set('Targets',jarray.array([ObjectName('com.bea:Name=pvserver,Type=Server')], ObjectName))

cd('/')
cmo.createJMSServer('JMSServer-0')

cd('/JMSServers/JMSServer-0')
cmo.setPersistentStore(getMBean('/Deployments/FileStore-0'))
set('Targets',jarray.array([ObjectName('com.bea:Name=pvserver,Type=Server')], ObjectName))

cd('/')
cmo.createJMSSystemResource('SystemModule-0')

cd('/JMSSystemResources/SystemModule-0')
set('Targets',jarray.array([ObjectName('com.bea:Name=pvserver,Type=Server')], ObjectName))

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')
cmo.createConnectionFactory('ConnectionFactory-0')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/ConnectionFactory-0')
cmo.setJNDIName('jms/Pid1QueueConnectionFactory')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/ConnectionFactory-0/SecurityParams/ConnectionFactory-0')
cmo.setAttachJMSXUserId(false)

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/ConnectionFactory-0')
cmo.setDefaultTargetingEnabled(true)

cd('/JMSSystemResources/SystemModule-0')
cmo.createSubDeployment('Queue-0')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')
cmo.createQueue('Queue-0')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/Queues/Queue-0')
cmo.setJNDIName('jms/Pid1TestQueue')
cmo.setSubDeploymentName('Queue-0')

cd('/JMSSystemResources/SystemModule-0/SubDeployments/Queue-0')
set('Targets',jarray.array([ObjectName('com.bea:Name=JMSServer-0,Type=JMSServer')], ObjectName))

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')
cmo.createQueue('Queue-1')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/Queues/Queue-1')
cmo.setJNDIName('QueueB')
cmo.setSubDeploymentName('Queue-0')

cd('/JMSSystemResources/SystemModule-0/SubDeployments/Queue-0')
set('Targets',jarray.array([ObjectName('com.bea:Name=JMSServer-0,Type=JMSServer')], ObjectName))

activate()

No comments: