SAF Queue Monitoring by WLST

WebLogic Store-and-Forward (SAF) service enables WebLogic Server to deliver messages reliably between applications that are distributed across WebLogic Server instances.

The SAF service should be used in case of forwarding JMS messages between Weblogic servers or domains. The SAF service can deliver messages between two stand-alone instances or servers instances in a cluster. Also the SAF service can deliver messages across two clusters in a domain and seperate domains.

But forwarding messages to prior releases of WebLogic Server, and inter-operating with third-party JMS products, the SAF service should not be used.

SAF queue monitoring can be done through WebLogic Server admin console where you follow “Store-and-Forward Agents” link under “Services > Messaging” path. Today, this monitoring action is going to be done by WebLogic Scripting Tool (WLST).

Domain Structure Path: Store-and-Forward Agents

Domain Structure Path: Store-and-Forward Agents

The WebLogic Scripting Tool (WLST) is a command-line scripting interface that system administrators and operators use to monitor and manage WebLogic Server instances, and domains. The WLST scripting environment is based on the Java scripting interpreter, Jython. In addition to WebLogic scripting functions, you can use common features of interpreted languages, including local variables, conditional variables, and flow control statements. So by WLST, domain configuration and run-time information are retrieved and edited. Also domain configuration tasks and application deployments could be automated. All the servers including admin and managed ones could be controlled.

The WLST working type is to use that scripting tool online by connecting to a running Administration Server or Managed Server instance or offline – no connection to any running server.

Now, the following codes will give an idea about how SAF queues have been monitored by using WLST.

The main idea of the code is to connect to admin server and retrieve the information from all managed servers. “getAgents()” is method in interface and it gets the SAF agents for your WebLogic server.

 

connect('your_username','your_password','t3://your_IP:your_port')
domainConfig()
servers=cmo.getServers()
domainRuntime()
safPrintqueue = []

for name in servers:
	path="/ServerRuntimes/"+name.getName()+"/SAFRuntime/"+name.getName()+".saf/Agents"
	cd(path)
	agents=cmo.getAgents()
	for agName in agents:
		print agName
		pathAGent = str(agName.getName())
		if "ReliableWseeSAFAgent_" in pathAGent:
			pass
		else:
			cd(pathAGent)
			msgCurrCount = cmo.getMessagesCurrentCount()
			safPrintqueue.append((msgCurrCount, pathAGent))

if (len(safPrintqueue) > 0):
				fo = open("/.../.../.../your_sample.log", "wb")
				for safElement in safPrintqueue:
						fo.write("%-5s %-10s\n" % tuple(safElement))
				fo.close()

 

Tags: ,

About the Author

S. Cagatay Yigiter is a Middleware Consultant and works onsite at Turk Telekom, Ankara. He daily operates high level, mission critical OSB and SOA domains successfully.

Post a Reply

Your email address will not be published. Required fields are marked *

Top