Thursday, April 17, 2014

Migrating the JMS file store to DB store through WLST script in weblogic server- Oracle SOA Suite

Migrating the JMS file store to DB store through WLST script  in weblogic server- Oracle SOA Suite

The below script will help us to migrate the JMS file store to DB store through WLST script  in weblogic server- Oracle SOA Suite. Before executing this script the required data source here EAIJMSDataSource should be created pointing to the database schema created for JMS.
For clustered environment the same should be executed for all the servers in the cluster with unique JDBC store name(e.g WseeJaxwsJDBCStore1 for server 1 and WseeJaxwsJDBCStore2 for server 2).

Script to migrate JMS file store to DB store

import sys

print "@@@ Starting the script ..."

from java.util import *
from javax.management import *

#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain=os.environ["WLSDOMAIN"]
print "WLSDOMAIN="+wlsDomain


adminURL='t3://'+domainProps.get('domain1.AdminIP')+':'+domainProps.get('domain1.AdminPort')
adminUserName='weblogic'
adminPassword=domainProps.get("domain1.AdminPasswd")
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
############# JDBC stores for STANDALONE ADMINSERVER
cd('/')

cmo.createJDBCStore('WseeJaxwsJDBCStore')
cd('/JDBCStores/WseeJaxwsJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('WseeJaxws')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

cd('/')
cmo.createJDBCStore('UMSJMSJDBCStore')
cd('/JDBCStores/UMSJMSJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('UMSJMS')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

cd('/')
cmo.createJDBCStore('SOAJMSJDBCStore')
cd('/JDBCStores/SOAJMSJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('SOAJMS')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

cd('/')
cmo.createJDBCStore('JDBCStore')
cd('/JDBCStores/JDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('rmjdbcstore')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

cd('/')
cmo.createJDBCStore('WseeJDBCStore')
cd('/JDBCStores/WseeJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('Wsee')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

cd('/')
cmo.createJDBCStore('BPMJMSJDBCStore')
cd('/JDBCStores/BPMJMSJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
cmo.setPrefixName('BPMJMS')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

#### end of creating jdbc stores

############Set Persistent Stores for all the JMS Servers

cd('/Deployments/WseeJaxwsJmsServer')
cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore'))


cd('/Deployments/UMSJMSServer')
cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore'))


cd('/Deployments/BPMJMSServer')
cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore-0'))


cd('/Deployments/SOAJMSServer')
cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore'))


cd('/Deployments/wlsbJMSServer')
cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore'))


cd('/Deployments/WseeJmsServer')
cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore'))

##### Set the persistent stores for all SAF agents
cd('/SAFAgents/ReliableWseeJaxwsSAFAgent')
cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore'))

cd('/SAFAgents/ReliableWseeSAFAgent')
cmo.setStore(getMBean('/JDBCStores/WseeJDBCStore'))

#################DESTROY ALL THE FILE STORES

cd('/')
cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore'))
cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore'))
cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore'))
cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore'))
cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore'))
cmo.destroyFileStore(getMBean('/FileStores/FileStore'))

save()
activate()

Execute the script:
cd %WLS_HOME%\common\bin
wlst.sh MigrateJMSFiletoJDBCStore.py

Restart the servers, the required tables({PrefixName}WLStore) will be created if the tables are not created already.



1 comment:

  1. Hi, I have a question if this solution also results in moving all non-processed messages from file store to JDBC store?

    ReplyDelete