Ravish Mody

Yesterday I was chatting with one of my ex-colleague Shruti and she requested me to write a post on Store-and-Forward (SAF) as the she was having some issue in configuring it and as usual the edocs are pretty confusing to do anything. So I took out sometime and wrote this post  which would help others too. For demo check out this post JMS Demo using Weblogic Store-and-Forward (SAF)

First of all lets understand what is Store-and-Forward (SAF) and then will look into how it works, how to configure it with its advantages.

What is Store-and-Forward (SAF)

Store-and-Forward (SAF) is a service which enables weblogic server to deliver messages reliably that is weblogic server make sure that the messages are been delivered between applications that are distributed across weblogic server instances.

How does Store-and-Forward (SAF) works

As the name suggests the messages gets stored at the Sender side in the persistence store and then are forwarded to the Receiver side using the SAF Agent.

Advantages of Store-and-Forward (SAF)

The main reason or the biggest advantage of Store-and-Forward (SAF) for which weblogic server had implemented was that they wanted the messages to be delivered to the receiver even when the receiver was down when the messages where sent.

Steps to Configure Store-and-Forward (SAF)

1.  You have to follow steps from Step-1 to Step-5 from the post Basic JMS Demo using WebLogic Queue for Domain-2 running on port 8001 and again same steps BUT this time only follow steps from Step-1 to Step-4 on Domain-1 running on port 7001.

2.  Now after doing the above step creating a SAF Agent

SAF-1

Creating SAF Agent

SAF-2

Targeting SAF Agent

3.  Create Sub Deployment for SAF in the same Module

SAF_Sub-1

Creating SAF Sub Deployment

SAF_Sub-2

Targeting SAF Sub Deployment

4. Creating Remote SAF Context in the same Module

SAF_RSC-1

Creating Remote SAF Context

SAF_RSC-2

Configuring Remote SAF Context

5.  Creating SAF Imported Destination in the same Module

SAF_ID-1

Creating SAF Imported Destination

SAF_ID-2

Configuring SAF Imported Destination

SAF_ID-3

Targeting SAF Imported Destination

SAF_ID-4

Advanced Targeting SAF Imported Destination to the SAF Sub-Deployment


6.  Creating SAF Imported Destination Queue

SAF_ID-5

Selecting Created SAF Imported Destination

SAF_ID-6

Creating SAF Imported Destination Queue

SAF_ID-7

Configuring "Remote" JNDI SAF Imported Destination Queue

SAF_ID-8

Selecting Created SAF Imported Destination Queue

SAF_ID-9

Configuring "Local" JNDI for SAF Imported Destination Queue

Following are the XML configuration which would look like from the SAF point of view

In config.xml file

<sub-deployment>
<name>Sub_SAF</name>
<target>MySAFAgent</target>
</sub-deployment>
<descriptor-file-name>jms/mysystemmodule-jms.xml</descriptor-file-name>
</jms-system-resource>
<admin-server-name>AdminServer</admin-server-name>
<saf-agent>
<name>MySAFAgent</name>
<target>AdminServer</target>
<store>FileStore</store>
<service-type>Both</service-type>
</saf-agent>

In mysystemmodule-jms.xml file


<saf-imported-destinations name="SAFImportedDestinations">
<sub-deployment-name>Sub_SAF</sub-deployment-name>
<saf-queue name="MySAFQueue">
<remote-jndi-name>TestQ</remote-jndi-name>
<local-jndi-name>Local</local-jndi-name>
<non-persistent-qos>At-Least-Once</non-persistent-qos>
<time-to-live-default>0</time-to-live-default>
<use-saf-time-to-live-default>false</use-saf-time-to-live-default>
<unit-of-order-routing>Hash</unit-of-order-routing>
</saf-queue>
<jndi-prefix>SAF_</jndi-prefix>
<saf-remote-context>MyRemoteSAFContext</saf-remote-context>
<saf-error-handling xsi:nil="true"></saf-error-handling>
<time-to-live-default>0</time-to-live-default>
<use-saf-time-to-live-default>false</use-saf-time-to-live-default>
</saf-imported-destinations>
<saf-remote-context name="MyRemoteSAFContext">
<saf-login-context>
<loginURL>t3://localhost:8001</loginURL>
<username>weblogic</username>
<password-encrypted>{3DES}zMJAPP2UbO1mNu9+Zx7/DA==</password-encrypted>
</saf-login-context>
</saf-remote-context>

Yup its little bit confusing but that’s it, your configuration for Store-and-Forward (SAF) has been finished. Hope this would help.

Regards,

Ravish Mody

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.