Wednesday, 14 September 2016

Communicate Between 2 Weblogic domains using SAF

I seen there are lots of material available in internet on implementation of Store And Forward JMS mechanism between two weblogic domains. Here in this blog I’ll repeat the same thing in simpler steps.
Configuration
1. First you need to have 2 weblogic domain up and running , for my case those two domains running on same machine.
2.For both of the domain go to domain name –>security from weblogic admin console .
image
Select cross domain security enabled and enter credentials and confirm credentials , for my case I’ve given welcome1.It might ask you to restart the server , please do the same.
3. Now assume you are producing one message in JMS queue of domain1 and same should be available to JMS queue of domain2. So in domain1 create a file based persistence store , give physical directory location and target the same to either admin or any managed server. For my case I targeted to SOA managed server.
image
4. Create a new JMS server say TestJMSServer and point to the persistence store that you created earlier
image
5.Create a new JMS module say TestJMSModule and create a new subdeployment say TestSubDeployment which point to TestJMSServer .So whatever the resource will be created under this module will be targeted to TestSundeployment.
image



Here is my Subdeployment tab,
image
6.So now in domain1 we’ll create a TestLocalQ where the message will be produced.So add a queue resource type under TestJMSModule and give a JNDI, I’ve given jms/b2b/TestLocalQ, but it can be any unique thing.
image
7.Then create RemoteSAFContext resource under the same module and give the URL of domain2 like below,
image


The port in the URL may vary depends on where your remote queue deployed, it might be remote admin server as well instead of any managed one.Give the remote weblogic username and password.
8.Now Create a SAFErrorHandling resource under the same module like below,
image
9.Then create SAFImportedDestinations resource and select remote saf context and saf error handling from the dropdown that you have created in earlier steps. Give some prefix for JNDI prefix , it will be useful at later stage.
image
10. Go to the Queue tab of TestSAFImportedDestinations  and create a new SAF queue.Here it will ask for JNDI of local and remote queue . At step 6 we created a local queue with JNDI jms/b2b/TestLocalQ . Similarly create a queue in domain2 with some JNDI say jms/b2b/TestRemoteQ .
image
11. So we almost set, create a Store-and-forward agent from weblogic console.
image

image
12. Bounce the server, both Admin and Managed.We’ll use BPEL JMS adapter to produce message on TestSAFQueue that we created in step 10 and that message should be available to the remote queue having JNDI jms/b2b/TestRemoteQ .
After restarting the server go to SAF agent that you created in step 10 and go to monitoring tab,Verify all the sub-tabs
image
13. Now create a SOA Composite and add a JMS adapter in external reference.
image
Definitely you’ll not find the SAF queue that you created in step 10, so give any other queue name and complete the wizard selecting any XSDs.
14. Edit the jca file of JMS adapter and change the DestinationName to SAF queue JNDI,
image


To find the correct JNDI go to admin console and select the server where you targeted your JMS module and server. In my case I pointed to SOA managed server and click on JNDI tree there,
image
From the list search for JNDI prefix you gave at step 9 and copy binding name , which need to be updated in the JCA file.
image
15.Now deploy the composite and test it
image
Go to domain2 queue and check the message there.
image

No comments:

Post a Comment