Configuring Message Bridge Between two Weblogic Server Domains using WLST

The WebLogic Messaging Bridge provides interoperability between WebLogic JMS
implementations, and other messaging products. Use the Messaging Bridge to communicate
wtih the Messaging based applications. Any implementations of WebLogic JMS, including
separate release of WebLogic Server. It can be WebLogic JMS and third-party JMS product
like MQSeries.A messaging bridge instance forwards messages between a pair of bridge source
and target destinations.

Step-1) Create two domains domain1 with Admin Server running on port 7001 and domain2
with Admin Server running on port 7003.

Step-2) Run domain1.py to create all the JMS Configurations for Message Brigde on domain1

domain1.py

—————————-

connect(‘weblogic’,’weblogic’,’t3://localhost:7001′)
## Creating a JMS Server
edit()
startEdit()
cd(‘/’)
print ‘Creating JMS Server.’
cmo.createJMSServer(‘JMSServer0′)
cd(‘/JMSServers/JMSServer0′)
cmo.addTarget(getMBean(‘/Servers/AdminServer’))
activate()

## Creating a Module

edit()
startEdit()
cd(‘/’)
cmo.createJMSSystemResource(‘JMSSystemResource0′)
cd(‘/JMSSystemResources/JMSSystemResource0′)
cmo.addTarget(getMBean(‘/Servers/AdminServer’))
cmo.createSubDeployment(’subdeployment0′)
activate()

#Create a Queue

edit()
startEdit()
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0′)
cmo.createQueue(‘Queue0′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0/Queues/
Queue0′)
set(‘JNDIName’,’Queue0′)
set(‘SubDeploymentName’,’subdeployment0′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/SubDeployments/subdeployment0′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=JMSServer0,Type=JMSServer’)],ObjectName))
activate()

##Create a connection Factory

edit()
startEdit()
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0′)
cmo.createConnectionFactory(‘ConnectionFactory0′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0/
ConnectionFactories/ConnectionFactory0′)
set(‘JNDIName’,’ConnectionFactory0′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0/
ConnectionFactories/ConnectionFactory0/SecurityParams/ConnectionFactory0′)
set(‘AttachJMSXUserId’,’false’)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0/
ConnectionFactories/ConnectionFactory0′)
set(‘SubDeploymentName’,’subdeployment0′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/SubDeployments/subdeployment0′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=JMSServer0,Type=JMSServer’)],
ObjectName))
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource0/JMSResource/JMSSystemResource0/
ConnectionFactories/ConnectionFactory0/DefaultDeliveryParams/ConnectionFactory0′)
set(‘DefaultTimeToLive’,’0′)
activate()

##Create Bridge Destination

edit()
startEdit()
cd(‘/’)
cmo.createJMSBridgeDestination(‘JMSBridgeDestination0′)
cd(‘/JMSBridgeDestinations/JMSBridgeDestination0′)
set(‘Classpath’,”)
set(‘ConnectionURL’,’t3://localhost:7001′)
set(‘AdapterJNDIName’,’eis.jms.WLSConnectionFactoryJNDIXA’)
set(‘ConnectionFactoryJNDIName’,’ConnectionFactory0′)
set(‘DestinationJNDIName’,’Queue0′)
set(‘UserName’,’weblogic’)
set(‘UserPassword’,’weblogic’)
cd(‘/’)
cmo.createJMSBridgeDestination(‘JMSBridgeDestination1′)
cd(‘/JMSBridgeDestinations/JMSBridgeDestination1′)
set(‘Classpath’,”)

set(‘ConnectionURL’,’t3://localhost:7003′)
set(‘AdapterJNDIName’,’eis.jms.WLSConnectionFactoryJNDIXA’)
set(‘ConnectionFactoryJNDIName’,’ConnectionFactory1′)
set(‘DestinationJNDIName’,’Queue1′)
set(‘UserName’,’weblogic’)
set(‘UserPassword’,’weblogic’)
activate()

##Create Target Bridge

edit()
startEdit()
cd(‘/’)
cmo.createMessagingBridge(‘Bridge0′)
cd(‘/Deployments/Bridge0′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=AdminServer,Type=Server’)],
ObjectName))
cmo.setSourceDestination(getMBean(‘/JMSBridgeDestinations/JMSBridgeDestination0′))
cmo.setTargetDestination(getMBean(‘/JMSBridgeDestinations/JMSBridgeDestination1′))
set(‘Started’,’true’)
set(‘Selector’,”)
set(‘QualityOfService’,’Exactly-once’)
set(‘QOSDegradationAllowed’,’true’)
set(‘IdleTimeMaximum’,’60’)
set(‘AsyncEnabled’,’true’)
set(‘DurabilityEnabled’,’true’)
set(‘PreserveMsgProperty’,’false’)
set(‘Started’,’true’)
activate()
disconnect()
exit()

Step-3) Run domain2.py to create all the JMS Configurations for Message Brigde on domain2

domain2.py

——————————-

connect(‘weblogic’,’weblogic’,’t3://localhost:7003′)

## Creating a JMS Server
edit()
startEdit()
cd(‘/’)
print ‘Creating JMS Server.’
cmo.createJMSServer(‘JMSServer1′)
cd(‘/JMSServers/JMSServer1′)
cmo.addTarget(getMBean(‘/Servers/AdminServer’))
activate()

#Create JMS Module
edit()

startEdit()
cd(‘/’)
cmo.createJMSSystemResource(‘JMSSystemResource1′)
cd(‘/JMSSystemResources/JMSSystemResource1′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=AdminServer,Type=Server’)],
ObjectName))
cmo.createSubDeployment(’subdeployment1′)
activate()

##Create a connection Factory
edit()
startEdit()
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1′)
cmo.createConnectionFactory(‘ConnectionFactory1′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1/
ConnectionFactories/ConnectionFactory1′)
set(‘JNDIName’,’ConnectionFactory1′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1/
ConnectionFactories/ConnectionFactory1/SecurityParams/ConnectionFactory1′)
set(‘AttachJMSXUserId’,’false’)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1/
ConnectionFactories/ConnectionFactory1′)
set(‘SubDeploymentName’,’subdeployment1′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/SubDeployments/subdeployment1′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=JMSServer1,Type=JMSServer’)],
ObjectName))
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1/
ConnectionFactories/ConnectionFactory1/DefaultDeliveryParams/ConnectionFactory1′)
set(‘DefaultTimeToLive’,’0′)
activate()

#Create a Queue
edit()
startEdit()
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1′)
cmo.createQueue(‘Queue1′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/JMSResource/JMSSystemResource1/Queues/
Queue1′)
set(‘JNDIName’,’Queue1′)

set(‘SubDeploymentName’,’subdeployment1′)
cd(‘/’)
cd(‘/JMSSystemResources/JMSSystemResource1/SubDeployments/subdeployment1′)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=JMSServer1,Type=JMSServer’)],
ObjectName))
activate()

Step-4) Setup the trust between two domains by having the same embedded ldap credentials on
both the domains.

Step-5) Deploy the jms-xa-adp.rar file (JNDI: eis.jms.WLSConnectionFactoryJNDIXA) on
domain1

Step-6) Test the bridge using the QueueSend and QueueReceive Program.
Change the JNDI name as Queue0,ConnectionFactory0 in QueueSend, and
Queue1,ConnectionFactory1 in QueueReceive Program.

Step-7) Enable Debugging to understand the debug message.
-Dweblogic.debug.DebugMessagingBridgeStartup=true
-Dweblogic.debug.DebugMessagingBridgeRuntime=true

References

http://download.oracle.com/docs/cd/E11035_01/wls100/bridge/design.html#wp1172930
http://download.oracle.com/docs/cd/E11035_01/wls100/bridge/bridgeTOC.html
http://download.oracle.com/docs/cd/E11035_01/wls100/bridge/bridgefaq.html