java weblogic.wlst_weblogic使用wlst脚本实现自动部署

博客展示了使用Java和WebLogic WLST创建JMS模块的代码。定义了IP、端口和JMS模块列表,包含连接工厂和队列资源。创建了创建JMS模块的函数,在函数中连接WebLogic,编辑并启动编辑,按模块和资源进行配置,最后保存并激活配置。

ip="10.199.137.124"nwport=8001wwport=9001nwjsmodule_list=[

{"name":"JmsModule-mhnw","resources":[

{"resourcename":"jms/connFactMhnw","type":"connectFactory"},

{"resourcename":"jms/queueMhnwEmail","type":"queue"},

{"resourcename":"jms/queueMhnwOperateLog","type":"queue"},

{"resourcename":"jms/queueMhnwSms","type":"queue"},

{"resourcename":"jms/queueMhnwZcm","type":"queue"}

],"targets":["wtmhnw"]},

{"name":"SystemModule-wsz","resources":[

{"resourcename": "jms/connFactNsqd", "type": "connectFactory"},

{"resourcename": "jms/queueMakeNsqd", "type": "queue"},

{"resourcename": "jms/queueNsqdEmail", "type": "queue"}

],"targets":["wtwsznw"]

}

]

wwjsmodule_list=[

{"name": "JmsModule-mhww", "resources": [

{"resourcename": "jms/connFactMhww", "type": "connectFactory"},

{"resourcename": "jms/queueMhwwEmail", "type": "queue"},

{"resourcename": "jms/queueMhwwSms", "type": "queue"}

]

}

]defcreate_jmsmodule(port,jsmodule_list):

connect('weblogic', 'aaaaa', 't3://%s:%s' %(ip,port))

edit()

startEdit()for jsmodule injsmodule_list:

cd('/')

cmo.createJMSSystemResource('%s' %jsmodule["name"])

cd('/SystemResources/%s' %jsmodule["name"])

taglist=[]for tag in jsmodule["targets"]:

taglist.append(ObjectName('com.bea:Name=%s,Type=Server' %tag))

set('Targets', jarray.array(taglist, ObjectName))for resource in jsmodule["resources"]:

cd('/JMSSystemResources/%s/JMSResource/%s' % (jsmodule["name"],jsmodule["name"]))if resource["type"]=="connectFactory":

cmo.createConnectionFactory('%s' %resource["resourcename"])

cd('/JMSSystemResources/%s/JMSResource/%s/ConnectionFactories/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"]))

cmo.setJNDIName('%s' %resource["resourcename"])

cd('/JMSSystemResources/%s/JMSResource/%s/ConnectionFactories/%s/SecurityParams/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"],resource["resourcename"]))

cmo.setAttachJMSXUserId(false)

cd('/JMSSystemResources/%s/JMSResource/%s/ConnectionFactories/%s/ClientParams/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"],resource["resourcename"]))

cmo.setClientIdPolicy('Restricted')

cmo.setSubscriptionSharingPolicy('Exclusive')

cmo.setMessagesMaximum(10)

cd('/JMSSystemResources/%s/JMSResource/%s/ConnectionFactories/%s/TransactionParams/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"],resource["resourcename"]))

cmo.setXAConnectionFactoryEnabled(true)

cd('/JMSSystemResources/%s/JMSResource/%s/ConnectionFactories/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"]))

cmo.setDefaultTargetingEnabled(true)else:

cmo.createUniformDistributedQueue('%s' %resource["resourcename"])

cd('/JMSSystemResources/%s/JMSResource/%s/UniformDistributedQueues/%s' %(jsmodule["name"],jsmodule["name"],resource["resourcename"]))

cmo.setJNDIName('%s' %resource["resourcename"])

cmo.setDefaultTargetingEnabled(true)

save()

activate(block="true")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值