How to show pending messages using WLST?

Posted by lmestre on Oracle Blogs See other posts from Oracle Blogs or by lmestre
Published on Tue, 12 Nov 2013 00:17:12 +0000 Indexed on 2013/11/12 4:04 UTC
Read the original article Hit count: 278

Filed under:

Here are the steps:

1. . ./setDomainEnv.sh
2. java weblogic.WLST
3. connect('weblogic','welcome1','t3://localhost:7001')
4. domainRuntime()
5. cd('ServerRuntimes/MS1/JMSRuntime/MS1.jms/JMSServers/JMSServer1/Destinations/JMSModule1!Queue1')
6. cursor1=cmo.getMessages('true',9999999,10)
                                                 **String(selector),Integer(timeout),Integer(state)
7. msgs = cmo.getNext(cursor1, 10)
                  ** This step gets 10 messages, you can call again cmo.getNext(cursor1, 10) to get the next 10 msgs
8. print(msgs)


My assumption, is that you had created:
a. Managed Server MS1.
b. JMS Server JMSServer1.
c. Module called JMSModule1.
d. Inside of JMSModule1, a Queue called Queue1.



If you read my previous post:

How to get Messages Pending Count from a Queue using WLST?
https://blogs.oracle.com/LuzMestre/entry/how_to_get_messages_pending

You can see that both are very similar.  Sometimes it is difficult to get a WLST Script sample, but you can use ls() function to know about other functionalities you don't have a sample code.

***Until step 5, nothing new comparing to my previous post.
5. cd('ServerRuntimes/MS1/JMSRuntime/MS1.jms/JMSServers/JMSServer1/Destinations/JMSModule1!Queue1')
6. ls()


You will see, MessagesPendingCount, getMessages along a lot of other functionalities available in this Queue.

e.g, you can see:
-r-x   getMessages                                  String : String(selector),Integer(timeout),Integer(state)

Here you can check the complete MBean Reference:
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13951/core/index.html
See JMSDestinationRuntimeMBean.

Enjoy!

© Oracle Blogs or respective owner

Related posts about /Oracle