Sunday, September 11, 2011

SAFfic love...aka Getting started with SAF

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

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:

and under weblogic.jms.backend

Binding Name:

** 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(
at weblogic.jndi.internal.BasicNamingNode.lookupHere(
at weblogic.jndi.internal.ServerNamingNode.lookupHere(
at weblogic.jndi.internal.BasicNamingNode.lookup(
at weblogic.jndi.internal.WLEventContextImpl.lookup(
at weblogic.jndi.internal.WLContextImpl.lookup(
at weblogic.jms.forwarder.Forwarder$Subforwarder.lookupTargetDestination(
at weblogic.jms.forwarder.Forwarder$Subforwarder.connectLocalJMS(
at weblogic.jms.forwarder.Forwarder$Subforwarder.access$100(
at weblogic.jms.forwarder.Forwarder.reconnect(
at weblogic.jms.forwarder.Forwarder.timerExpired(

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:

The logs should trace:

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

SAF Remote Context

SAF Imported Destination
contains a reference to SAF Remote Context

No comments: