Sunday, September 11, 2011

SAFfic love...aka Getting started with SAF

Good "getting started guide" by our Indian-Dutch friends of MiddlewareMagic:

http://weblogic-wonders.com/weblogic/2010/06/14/configuring-saf-store-and-forward-between-two-weblogic-server-domains/

In a nutshell, to get started you need:
a Persistent Store, a SAF Agent, a JMS Module, a SAF Imported Destinations with a SAF Queue, a SAF Remote Context, and a JMS Queue on the target server.

** create managed servers ms1 and ms2. ms2 will contain the SAF Agent, ms1 the destination queue.

** on ms2 create a persistent store "filestore2"

** create a SAF Agent "TESTSAFAgent", Sending only, targeted to the Persistent Store "filestore2" on ms2
(the SAF Agent doesn't use a JMS Server, only a Persistent Store)


This will appear in the JNDI tree, under weblogic.jms:

Binding Name:
weblogic.jms.ServerSessionPoolFactory:TESTSAFAgent@ms2
Class:
weblogic.jms.backend.BEServerSessionPoolFactory

and under weblogic.jms.backend

Binding Name:
weblogic.jms.backend.TESTSAFAgent@ms2
Class:
weblogic.jms.common.JMSServerId



** Create a JMSModule "SAFTestModule", target to ms2

this will populate JNDI with an entry "weblogic.SAFTestModule "

** Create a "SAFImportedDestinations0", assign to it a newly created "SAFImportedDestinationsSD" SubDeployment also targeted to ms2

This doesn't bring anything in the JNDI tree

** Create a "RemoteSAFContext-0" and associate it to "SAFImportedDestinations0"


** under "SAFImportedDestinations0", create a SAF queue "SAFTestQueue"
providing a SAFTESTREMOTE_ON_MS1 remote JNDI name, and SAFTESTLOCAL_ON_MS2 local JNDI names

this creates in JNDI a
Binding Name: SAFImportedDestinations0SAFTESTLOCAL_ON_MS2
Class: weblogic.jms.common.DistributedDestinationImpl

and a
Binding Name: SAFTestModule!SAFImportedDestinations0!SAFTESTLOCAL@TESTSAFAgent@SAF
Class: weblogic.jms.common.DestinationImpl

The engine is ready to start. If you activate now, you will see in the logs:

####<09-Sep-2011 13:57:04 o'clock BST> <Info> <JMS> <pierrepc> <ms2> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1315573024219> <BEA-040507> <The JMS SAF forwarder failed to connect to the remote destination "null/SAFTESTREMOTE_ON_MS1", because of javax.naming.NameNotFoundException: Unable to resolve 'SAFTESTREMOTE_ON_MS1'. Resolved ''; remaining name 'SAFTESTREMOTE_ON_MS1'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
at weblogic.jms.forwarder.Forwarder$Subforwarder.lookupTargetDestination(Forwarder.java:611)
at weblogic.jms.forwarder.Forwarder$Subforwarder.connectLocalJMS(Forwarder.java:572)
at weblogic.jms.forwarder.Forwarder$Subforwarder.access$100(Forwarder.java:533)
at weblogic.jms.forwarder.Forwarder.reconnect(Forwarder.java:275)
at weblogic.jms.forwarder.Forwarder.timerExpired(Forwarder.java:311)
at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
.>

weblogic.jms.common.JMSException: Error producing message for destination MS1SystemModule!SAFTESTREMOTE_ON_MS1

weblogic.jms.common.JMSException: Error producing message for destination MS1SystemModule!SAFTESTREMOTE_ON_MS1
weblogic.messaging.dispatcher.DispatcherException: could not find Server ms1

Caused by: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.messaging.dispatcher.S:ms1'. Resolved 'weblogic.messaging.dispatcher'; remaining name 'S:ms1'

Undelivered messages are visible on
TESTSAFAgent/Monitoring/Remote Endpoints/ SAFTestModule!SAFImportedDestinations0!SAFTESTLOCAL@TESTSAFAgent@ms2


** You need to create the "SAFTESTREMOTE_ON_MS1" JMS Queue on ms1 and start ms1. At this point the SAF Agent is happy.



You also get a log file in jms.messages.log - if you enable message logging it should contain details of the forwarded messages.

Monitoring pages are available at SAFAgent level, and at ImportedDestination level



Message should arrive at destination. The message has these properties set:
JMS_BEA_SAF_SEQUENCE_NAME=osb_domain@myCluster@ms2@SAFTestModule!SAFImportedDestinations0!SAFTESTLOCAL@TESTSAFAgent@ms2201109091356440079
JMS_BEA_SAF_SEQUENCE=1


The logs should trace:

BEA-040506 The JMS SAF forwarder has successfully connected to the remote destination "null/SAFTESTREMOTE_ON_MS1".





SAF Remote Context http://edocs.bea.com/wls/docs103/wlsmbeanref/mbeans/SAFRemoteContextBean.html


SAF Imported Destination
http://edocs.bea.com/wls/docs103/wlsmbeanref/mbeans/SAFImportedDestinationsBean.html
contains a reference to SAF Remote Context

No comments: