Tuesday, June 24, 2014

Create Weblogic JMS SAF (Store and Forward) using WLST

As a follow up to my last blog, here is a simple WLST script to automate the whole process of creating EDN specific SAF on a non-SOA Weblogic server

----------------------------------------------------------------------------------------

######################################################
# This WLST will connect to the 'local' weblogic server
# and create a remote SAF connection as mentioned below.
# It is written to create a SystemModule-0 JMS Module,
# Create two connection factories (XA and non-XA),
# RemoteContext, SAFImportedDestination
# and a remorte queue for EDN setup on a non-SOA weblogic.
# However, the script can be modified to create any JMS object.

# Make sure to edit/verify the lines at <---xxx---> comments
# to suit the environment
#######################################################

#connect('weblogic', 'welcome1', 'soabpm-vm.site:7001')
connect()

edit()

startEdit()

#Create SAF Agent
cd('/')

cmo.createSAFAgent('SAFAgent-0')

cd('/SAFAgents/SAFAgent-0')

cmo.setServiceType('Sending-only')

#JMS Module
cd('/')

cmo.createJMSSystemResource('SystemModule-0')

cd('/SystemResources/SystemModule-0')

#<-------------specify -------="" cluster="" etc.="" jms="" module="" server="" target-="" the="">
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

#Remote SAF Context
cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')

cmo.createSAFRemoteContext('RemoteSAFContext-0')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/SAFRemoteContexts/RemoteSAFContext-0/SAFLoginContext/RemoteSAFContext-0')

#<----specify ------="" host="" pwd="" remote="" server="" user="">
cmo.setLoginURL('t3://soabpm-vm.site:7001')
cmo.setUsername('weblogic')
cmo.setPassword('welcome1')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')

#Create EDN connection factories
#<--------specify --------="" connection="" factory="" jndi="" names="">
cmo.createConnectionFactory('EDNConnectionFactory');
cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/EDNConnectionFactory')
cmo.setJNDIName('jms/fabric/EDNConnectionFactory')
cmo.setDefaultTargetingEnabled(true)
cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/EDNConnectionFactory/TransactionParams/EDNConnectionFactory')
cmo.setXAConnectionFactoryEnabled(true)

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')
cmo.createConnectionFactory('XAEDNConnectionFactory')
cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/ConnectionFactories/XAEDNConnectionFactory')
cmo.setJNDIName('jms/fabric/xaEDNConnectionFactory1')
cmo.setDefaultTargetingEnabled(true)




cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0')

cmo.createSAFImportedDestinations('SAFImportedDestinations-0')
cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/SAFImportedDestinations/SAFImportedDestinations-0')
cmo.setSAFRemoteContext(getMBean('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/SAFRemoteContexts/RemoteSAFContext-0'))
cmo.setSAFErrorHandling(None)
cmo.setTimeToLiveDefault(0)
cmo.setUseSAFTimeToLiveDefault(false)
cmo.setDefaultTargetingEnabled(true)

#SAF Queue
cmo.createSAFQueue('SAFQueue-1')


cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/SAFImportedDestinations/SAFImportedDestinations-0/SAFQueues/SAFQueue-1')

#<---------specify configured="" currently="" edn="" for="" name.="" queue------------="" queue="" remote="" the="">
cmo.setRemoteJNDIName('jms/fabric/EDNQueue')

cmo.setNonPersistentQos('At-Least-Once')
cmo.setTimeToLiveDefault(0)
cmo.setUseSAFTimeToLiveDefault(false)
cmo.setUnitOfOrderRouting('Hash')

cd('/JMSSystemResources/SystemModule-0/JMSResource/SystemModule-0/SAFImportedDestinations/SAFImportedDestinations-0/MessageLoggingParams/SAFImportedDestinations-0')
cmo.setMessageLoggingEnabled(false)
cmo.setMessageLoggingEnabled(true)
cmo.setMessageLoggingFormat('%header%,JMSCorrelationID,JMSDeliveryMode,JMSDestination,JMSExpiration,JMSMessageID,JMSPriority,JMSRedelivered,JMSReplyTo,JMSTimestamp,JMSType,%properties%')


cd('/')


activate()
#####################################################

----------------------------------------------------------------------------------------

No comments:

Post a Comment