In a typical SOA Suite production cluster deployment, load balancing the JMS topic messages against the SOA composites will be a common requirement. It is to ensure that messages are evenly distributed (load balanced) to SOA cluster members, and to avoid duplication in some scenarios. This can be achieved by configuring the SOA JMS Topic to use a "Distributed Destination" setting the appropriate forwarding policy and other advanced parameters.
Here is a sample WLST offline script:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
#======================================================================= | |
# Function to configure WLS JMS Uniform Distributed Topic | |
#======================================================================= | |
def configureWlsJMSDistributedTopic (jmsModule, jmsTopic, jndiName, forwardPolicy, subDeploymentName): | |
print '========= START Configuring WLS JMS Distributed Topic for ['+jmsTopic+'] =========' | |
try: | |
cd ('/') | |
# assumes 'jmsModule' already exists | |
cd ('/JMSSystemResource/'+jmsModule+'/JmsResource/NO_NAME_0') | |
# create Uniform Distributed Topic (UDT) | |
create (jmsTopic, 'UniformDistributedTopic') | |
cd ('UniformDistributedTopic/'+jmsTopic) | |
# set UDT properties | |
cmo.setJNDIName(jndiName) | |
# forwarding policy - Partitioned / Replicated (default) | |
cmo.setForwardingPolicy(forwardPolicy) | |
# assumes 'subDeploymentName' already exists | |
cmo.setSubDeploymentName(subDeploymentName) | |
except Exception, detail: | |
raise Exception ('Exception configuring WLS JMS Uniform Distributed Topic') | |
print '-------------- END Configuring WLS JMS Uniform Distributed Topic for ['+jmsTopic+'] --------------' | |
######################################################################## | |
# MAIN | |
######################################################################## | |
wlsDomainHome= " " | |
try: | |
wlsDomainHome = sys.argv[1] | |
except: | |
print 'WARNING:Not all command line parameters specified' | |
if (wlsDomainHome == " "): | |
sys.exit() | |
# read Domain | |
try: | |
readDomain(wlsDomainHome) | |
print '***** Read Domain: %s' % wlsDomainHome | |
except : | |
print 'XXXXX Could not Read Domain: %s' % wlsDomainHome | |
exit() | |
try: | |
# create WLS JMS Uniform Distributed Topic | |
configureWlsJMSDistributedTopic ("TestJMSModule", "SampleUDTopic", "jms/test/SampleUDTopic", | |
"Partitioned", "TestSubDeployment") | |
print 'Updating and Closing Domain' | |
updateDomain() | |
closeDomain() | |
except Exception, detail: | |
print 'FINAL Exception:', detail | |
dumpStack() | |
exit() |
Note that there in no support to define the UniformDistributed Queue/Topic in weblogic application extension templates' file config/jms/<%jms-module%>-jms.xml (as of the latest SOA PS6 release). Refer the "Fusion Middleware Programming JMS for Oracle WebLogic Server" guide for more details on WLS JMS Distributed Destinations.