8 Replies Latest reply: Aug 12, 2009 10:25 AM by 714657 RSS

    Example using of getMessage(s) with JMS error queues?

    714657
      Hi,

      I'm cobbling together various tools for easier management of replaying messages left in error queues and the likes, and whilst I've got messages being moved around the place on demand, I can't make any progress using getMessage() and getMessages() to print out vital statistics of a message / all the messages in a queue, including hopefully ripping out excerts of the XML payload in them. Can someone provide / point me to an example of these being in use? I can get a successful execution of getMessages() but am usure what to really do next with the object returned, how to iterate through and such.

      Thanks

      Chris.
        • 1. Re: Example using of getMessage(s) with JMS error queues?
          Tom B
          Hi Chris,

          There are open source solutions for message management.  In particular, you might want to investigate Hermes:

          http://blogs.oracle.com/jamesbayer/2008/01/hermes_jms_open_source_jms_con.html

          As for browsing messages via getMessages(), here's a code snippet.  Note that one should never attempt to get too many messages at a time via "getNext()" -- instead call getNext() multiple times.  Otherwise, if there are too many messages, the client or server might run out of memory.
          # create a cursor to get all the messages in the queue 
          # by passing ‘true’ for selector expression,  
          # and long value for cursor timeout
          cursor1=cmo.getMessages(‘true’,9999999)
          
          # get the next 5 messages starting from the cursor’s 
          # current end position
          # this will adjust the cursor’s current start position and 
          # end position “forwards” by 5 
          msgs = cmo.getNext(cursor1, 5)
          
          # print all the messages’ contents
          print msgs
          
          # get 3 messages upto the cursor’s current start position
          # this will adjust the cursor’s current start and end position backwards by 3
          # this will the current position of the message by 1
          msgs = cmo.getPrevious(cursor1, 3)
          
          # print all the messages’ contents
          print msgs
          Finally, here's code based on public APIs that can help with exporting messages to a file.   It uses Java, not WLST. I haven't tested it personally.  I'm not sure if there's away to do this in WLST.
          /**
            * pseudo code for JMS Message Export operation based on 
            * current implementation in the Administration Console
            */
            import java.io.File;
            import java.io.FileOutputStream;
            import java.io.OutputStreamWriter;
            import java.io.BufferedWriter;
            import java.io.Writer;
            import java.io.IOException;
            import java.util.ArrayList;
            import java.util.Collection;
          
            import org.w3c.dom.Document;
            import org.w3c.dom.Element;
            import org.w3c.dom.Node;
           
            import weblogic.apache.xerces.dom.DocumentImpl;
            import weblogic.apache.xml.serialize.OutputFormat;
            import weblogic.apache.xml.serialize.XMLSerializer;  
          
            import weblogic.management.runtime.JMSDestinationRuntimeMBean;
            import weblogic.management.runtime.JMSDurableSubscriberRuntimeMBean;
            import weblogic.management.runtime.JMSMessageManagementRuntimeMBean;
          
            import javax.management.openmbean.CompositeData;
          
            import weblogic.jms.extensions.JMSMessageInfo;
            import weblogic.jms.extensions.WLMessage;
            import weblogic.messaging.kernel.Cursor;
          
            public void exportMessages(
              String fileName, 
              JMSDestinationRuntimeMBean destination, 
              /* or JMSDurableSubscriberRuntimeMBean durableSubscriber */, 
              String messageSelector) throws Exception {
          
              BufferedWriter bw = null;
              try {
          
                File selectedFile = new File(file);
          
                if (destination == null /* or durableSubscriber == null */) {
                  throw new IllegalArgumentException("A valid destination runtime or durableSubscriber runtime mbean must be specified");
                }
                JMSMessageManagementRuntimeMBean runtime = (JMSMessageManagementRuntimeMBean) destination /* durableSubscriber */;
                  
                bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));
                String xmlDeclaration = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
                String exportStart = "<JMSMessageExport>";
                final String exportEnd = "</JMSMessageExport>";
                final String indent = "    ";
            
                bw.write(xmlDeclaration);
                bw.newLine();
                bw.write(exportStart);
                bw.newLine();
                bw.newLine();
                bw.write(indent);
          
                CompositeData[] messageInfos = null;
                OutputFormat of = new OutputFormat();
                  
                of.setIndenting(true);
                of.setLineSeparator("\n"+indent);
                of.setOmitXMLDeclaration(true);
                  
                XMLSerializer ser = getXMLSerializer(bw, of);
          
                String cursor = JMSUtils.getJMSMessageCursor(runtime, selector,0);
          
                while ((messageInfos = runtime.getNext(cursor,new Integer(20))) != null) {
                  for (int i = 0; i < messageInfos.length; i++) {
                    JMSMessageInfo mhi = new JMSMessageInfo(messageInfos);
          Long mhiHandle = mhi.getHandle();
          CompositeData m = runtime.getMessage(cursor, mhiHandle);
          // need to get the message with body
          JMSMessageInfo mbi = new JMSMessageInfo(m);
          WLMessage message = mbi.getMessage();
          ser.serialize(message.getJMSMessageDocument());
          messageInfos[i] = null;
          }
          }
          bw.newLine();
          bw.write(exportEnd);
          bw.flush();
          bw.close();
          runtime.closeCursor(cursor);
          LOG.success("jms exportmessage success");
          } catch (Exception e) {
          try {
          if(bw != null)
          bw.close();
          } catch (IOException ioe) { }
          LOG.error(e);
          LOG.error("jms exportmessage error");
          throw(e);
          }
          LOG.success("jms exportmessage success");
          }

          private XMLSerializer getXMLSerializer(
          Writer writer,
          OutputFormat of) {

          return new XMLSerializer(writer, of) {
          protected void printText(
          char[] chars,
          int start,
          int length,
          boolean preserveSpace,
          boolean unescaped) throws IOException {
          super.printText(chars,start,length,true,unescaped);
          }

          protected void printText(
          String text,
          boolean preserveSpace,
          boolean unescaped ) throws IOException {
          super.printText(text,true,unescaped);
          }
          };
          }

          public static String getJMSMessageCursor(
          JMSMessageManagementRuntimeMBean runtime,
          String selector,
          int cursorTimeout) throws weblogic.management.ManagementException
          {
          return runtime.getMessages(
          selector,
          new Integer(cursorTimeout),
          new Integer(Cursor.ALL));
          }     
          Hope this helps,
          
          Tom                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
          • 2. Re: Example using of getMessage(s) with JMS error queues?
            user161771 - oracle
            As Tom mentioned, I personally like HermesJMS, I updated that blog link to reflect WLS 10gR3:
            http://blogs.oracle.com/jamesbayer/2009/02/hermes_jms_revisited_for_weblo.html
            • 3. Re: Example using of getMessage(s) with JMS error queues?
              714657
              Thanks, but I do need WLST examples.
              • 4. Re: Example using of getMessage(s) with JMS error queues?
                714657
                No one able to help?? really??
                • 5. Re: Example using of getMessage(s) with JMS error queues?
                  user161771 - oracle
                  A comprehensive whitepaper is planned on being published covering some of this, but what more specifically do you need? Tom's first code snippet in his earlier response shows how to use those API's in WLST.
                  • 6. Re: Example using of getMessage(s) with JMS error queues?
                    714657
                    Well I can see in the java examples a message being pulled out, which is of a certain amount of use, but I'm no expert at python and don't understand how to iterate through whatever it is actually get back from getMessages() and then move on to pull out the original message text (which is just xml for me) and also get other attributes of the message itself. The basic WLST help screens say that I can call getMessages() and it gives me a certain object back, but what to actually do with it then is where I break down.

                    Cheers

                    Chris
                    • 7. Re: Example using of getMessage(s) with JMS error queues?
                      650173
                      Hi Chris,

                      Please find the attached WLST script for browsing messages on a given destination (which will eventually be made available as part of the JMS runtime administration white paper).
                      Please read through the Usage syntax for more information.

                      Hope this helps.

                      Kats
                      Oracle WLS Messaging Team
                      """
                      WebLogic JMS Message Browsing Script for weblogic.WLST
                      
                      This script can be used for browsing messages on a WebLogic JMS Destination.
                      
                      Based on the arguments, the script creates can print out the contents of messages
                      that matched the selection crieteria (message filter and state). 
                      By default, the script prints out the message header values.
                      Both message properties and the body can be optionally printed by setting the appropriate option to "true"
                      
                      Usage: java weblogic.WLST msg_browsing.py [options]
                      
                      Options:
                        username=...           username to connect to WebLogic Server       - defaults to "weblogic".
                        password=...           password to connect to WebLogic Server       - defaults to "weblogic".
                        url=...                Provider URL of the Administration Server    - defaults to "t3://localhost:7001".
                        wlsServerName=...      WebLogic Server Name                         - defaults to "examplesServer".
                        jmsServerName=...      JMS Server Name that hosts the destination   - defaults to "examplesJMSServer".
                        jmsModuleName=...      JMS Module Name that defines the destination - defaults to "examples-jms".
                        jmsDestinationName=... JMS Destination name to browse               - defaults to "exampleQueue".
                        messageState=...       Print only thoses messages that are in the specified state. Valid states include: 'suspect', 'all transaction', 'send transaction', 'receive transaction', 'ordered', 'delayed', 'expired',  'visible', 'all'. The "suspect" state will retrun all the messages that are not in visible, ordered or deleted state. defaults to 'all'.
                        messageFilter=...      JMS Message Slector Expression               - defaults to "true".
                        elapsedTimeInSeconds=... Print the information about the messages that are on the destination longer than this time - defaults to 0 seconds.
                        cursorTimeoutInSeconds=... Amount time after which the curosr will get invalided - defaults "close". Value 0 means no timeout.
                        printHeaders=...       Whether to print the message header values   - defaults to "true".
                        printProperties=...    Whether to print the message properties values - defaults to "true".
                        printBody=...          Whether to print the message payload if it is of TextMessage - defaults to "true".
                        redirectStdout=...     File name to redirect the stdout of WLST     - defaults to no redirect and the results wil be printed out to stdout.
                        help                   Prints out this usage help
                      
                      Note that all the defaults are set based WebLogic Examples domain that is part of WebLogic Server installation.
                      The "examples" server can be started from "C:/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server" using startWebLogic.sh
                      
                      To try this script OOTB, start the "examples" server and run the JMS sample as described below.
                      
                      cd :/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server/bin
                      . ./setDomainEnv.sh
                      cd $WL_HOME/samples/server/examples/src/examples/jms/queue
                      javac -d . *.java
                      export CLASSPATH=".;$CLASSPATH"
                      java examples.jms.queue.QueueSend t3://localhost:7001
                      
                      Follow the prompts to populate the queue
                      
                      Examples:
                        msg_browsing.py - Prints out all the message contents on the exampleQueue destination
                      
                        msg_browsing.py user=weblogic pass=weblogic url=t3://localhost:7001
                                            wlsServerName=examplesServer jmsServerName=examplesJMSServer
                                      jmsModuleName=examples-jms jmsDestinationName=exampleQueue
                                      messageState=16 messageFilter="JMS_BEA_UnitOfOrder LIKE 'GREEN'"
                                      elapsedTimeInSeconds=60 cursorTimeoutInSeconds=close
                                      printHeaders=true printProperties=true printBody=true
                      
                      
                      For more details on JMS Message Management using WLST, see "WebLogic JMS Message Management In a Nutshell" whitepaper.
                      
                      
                      """
                      
                      from weblogic.jms.extensions import JMSMessageInfo
                      from weblogic.messaging.runtime import MessageInfo
                      from weblogic.messaging.kernel import Cursor
                      
                      from javax.jms import TextMessage
                      from javax.jms import DeliveryMode
                      
                      from java.io import ByteArrayOutputStream 
                      from java.io import StringBufferInputStream
                      
                      from java.util import Properties
                      from java.util import Date
                      
                      from java.lang import *
                      
                      import jarray
                      import sys
                      
                      
                      ################################################################
                      #
                      # shows_messages() definition
                      #
                      ################################################################
                      
                      
                      def show_messages(wlsServerName, jmsServerName, jmsModuleName, jmsDestinationName, messageState, messageFilter, elapsedTimeInSeconds, cursorTimeoutInSeconds, printHeaders, printProperties, printBody):
                      
                        elapsedTimeInMillis = long(elapsedTimeInSeconds) * 1000L
                        elapsedTimeInMillisInTimestampFormat = Date().getTime() - long(elapsedTimeInMillis)
                      
                        domainRuntime()
                        cd ('ServerRuntimes')
                      
                        spath = wlsServerName + "/JMSRuntime/" + wlsServerName +".jms"
                        cd (spath)
                      
                        fullDestName=jmsServerName+'/Destinations/'+jmsModuleName +'!'+jmsDestinationName
                        fullServerDestName=serverName+'/'+ fullDestName
                        cdPathForDestName='JMSServers/'+ fullDestName
                        cd (cdPathForDestName)
                      
                        if long(elapsedTimeInSeconds) > 0:
                          if messageFilter == "true":
                            messageFilter = "JMSTimestamp <= " + str(elapsedTimeInMillisInTimestampFormat)
                          else:
                            messageFilter = messageFilter + " AND " + "JMSTimestamp <= " + str(elapsedTimeInMillisInTimestampFormat)
                      
                        print "Creating message cursor using messageFilter="+ messageFilter + ", State=" + str(messageState)
                        
                        if cursorTimeoutInSeconds == "close":
                          cursor=cmo.getMessages(messageFilter, 0, int(messageState))
                        else:
                          cursor=cmo.getMessages(messageFilter, int(cursorTimeoutInSeconds), int(messageState))
                        cursorSize=cmo.getCursorSize(cursor)
                        print 'Destination: ' + fullServerDestName + ' has ' + str(cursorSize) + ' Messages that matched the specified filter/state/elapsed time criteria'
                      
                        if cursorSize == 0:
                          return
                      
                        print "Printing Message Contents"
                        while 1:
                          m = cmo.getNext(cursor,1)
                          if m is None:
                            break
                          jmsmsginfo = JMSMessageInfo(m[0])
                          wlmsg = jmsmsginfo.getMessage()
                          mstate = jmsmsginfo.getStateString()
                          xidstr = ''
                          if mstate.rfind("transaction") != -1:
                            xidstr = jmsmsginfo.getXidString() 
                      
                          wlmsgid = wlmsg.getJMSMessageID()
                          print '-------------------------------------------------------------------------------------------------------'
                          print 'JMS Message Detail for Message : ' + wlmsgid                    
                          print 'Message State ================>: \'' + mstate + '\''
                          if xidstr != '':
                            print 'Xid (From local JMS Branch) ==>: \'' + xidstr + '\''
                          print '-------------------------------------------------------------------------------------------------------'
                      
                          fullcursormsg = cmo.getMessage(cursor,wlmsgid)
                          fulljmsmsginfo = JMSMessageInfo(fullcursormsg)
                          fullwlmsg = fulljmsmsginfo.getMessage()
                      
                          if printHeaders == "true":
                            dumpMessageHeader(fullwlmsg)
                          if printProperties == "true":
                            dumpMessageProperties(fullwlmsg)
                          if printBody == "true":
                            dumpMessageBody(fullwlmsg)
                      
                        if cursorTimeoutInSeconds == "close":
                          print "Closing message cursor"
                          cmo.closeCursor(cursor)
                        else:
                          print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
                          print '!                                                                                           !'
                          print '! WARNING: The "cursorTimeoutInSeconds" commandline parameter value was specifed other than !'
                          print '!          "close" and so the cursor will holding onto the server resources until the       !'
                          print '!          timeout value expired.                                                           !' 
                          print '!                                                                                           !'
                          print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
                      
                      
                      ################################################################
                      #
                      # dumpMessageHeader() definition
                      #
                      ################################################################
                      
                      def dumpMessageHeader(msg):
                      
                        print '          '
                        print 'Headers:          '
                        print '          '
                      
                        mid = 'Message ID:     ' + msg.getJMSMessageID()
                        if msg.getJMSDeliveryMode()==DeliveryMode.PERSISTENT:
                          dmode =  'Delivery Mode:     PERSISTENT'
                        else:
                          dmode = 'DeliveryMode:     NON-PERSISTENT'
                        print mid + '     ' + dmode
                      
                        mtypevalue = msg.getJMSType()
                        if mtypevalue is None:
                          mtypestr = 'Type:          None'
                        else:
                          mtypestr = 'Type:          ' + mtypevalue
                      
                        mcorridvalue = msg.getJMSCorrelationID()
                        if mcorridvalue is None:
                          mcorridstr = 'CorrleationID:  None'
                        else:
                          mcorridstr = 'CorrelationID:     ' + mcorridvalue
                        print mtypestr + '                    ' + mcorridstr
                      
                        mtimestamp = 'Timestamp:     ' + Date(msg.getJMSTimestamp()).toString()
                        mexpirationvalue = msg.getJMSTimestamp()
                        if mexpirationvalue>0:
                          mexpiration = 'Expiration:     ' + Date(mexpirationvalue).toString()
                        else:
                          mexpiration = 'Expiration:     None'
                        print mtimestamp + '     ' + mexpiration
                      
                        mpriority = 'Priority:     '+ str(msg.getJMSPriority())
                        mredelivered = 'Redelivered:     ' + Boolean(msg.getJMSRedelivered()).toString()
                        print mpriority + '                    ' + mredelivered
                      
                      
                        mdeliverytimevalue = msg.getJMSDeliveryTime()
                        if mdeliverytimevalue>0:
                          mdeliverytime = 'DeliveryTime:     ' + Date(mdeliverytimevalue).toString()
                        else:
                          mdeliverytime = 'DeliveryTime:     None'
                      
                        mredeliverylimit = 'ReDeliveryLimit:  ' + str(msg.getJMSRedeliveryLimit())
                        if mdeliverytimevalue > 0:
                          print mdeliverytime + '     ' + mredeliverylimit
                        else:
                          print mdeliverytime + '                    ' + mredeliverylimit
                       
                      
                      ################################################################
                      #
                      # dumpMessagePropertie() definition
                      #
                      ################################################################
                      
                      def dumpMessageProperties(msg):
                      
                        print '          '
                        print 'Properties:          '
                        print '          '
                      
                        print '------------------------------------------------------------------'
                        print 'Key               | Value               | Type             '
                        print '------------------------------------------------------------------'
                        propnames=msg.getPropertyNames()
                        for key in propnames:
                          stringlist = []
                          value = msg.getObjectProperty(key)
                          stringlist.append(key)
                          stringlist.append(value)
                          if type(value) is str:
                            print "type of value="+ "String"
                            stringlist.append("String")
                          elif type(value) is int:
                            stringlist.append("Integer")
                          else:
                            stringlist.append(type(value).getName().replace("org.python.core.Py", ""))
                          print str(stringlist[0]) + '       ' + str(stringlist[1]) + '                 ' + str(stringlist[2])
                        
                      ################################################################
                      #
                      # dumpMessageBody() definition
                      #
                      ################################################################
                      
                      def dumpMessageBody(msg):
                        print '          '
                        print 'Payload:     '
                        print '          '
                        if isinstance(msg, TextMessage):
                          print 'Message Body Text: ' + msg.getText() 
                          print '          '
                      
                      
                      ################################################################
                      #
                      # Function to handle script arguments of the variety 'n=v', where
                      # arguments are placed into a dictionary of nv pairs and returned
                      # to the caller
                      #
                      ################################################################
                      
                      def argsToDict(args):
                        d = {}
                        for arg in args:
                          #print "arg: " + arg
                          pair = arg.split('=', 1)
                          #print "pair: " + str(pair)
                          if len(pair) == 2:
                            # binary argument, store as key pair
                            key = pair[0]
                            val = pair[1]
                            d[key] = val
                          else:
                            # Unary argument, story with empty (non-null) key
                            d[arg] = ''
                        print "Arguments: " + str(d)
                        return d 
                            
                      ################################################################
                      #
                      # Returns the value found in the provided map, at the location
                      # specified by 'key'; if no entry exists in the map for 'key',
                      # the provided default is returned. 
                      #
                      ################################################################
                      def getValue(dict, key, default=None):
                        ret = default
                        if dict is not None:
                          try:
                            ret=dict[key]
                          except KeyError:
                            pass
                        return ret
                        
                      # Connect to the target server specified in the provide args
                      def connectIfNecessary(argsDict=None):
                        # connect if necessary
                        if connected == "false":
                          user=getValue(argsDict, "user", "weblogic")
                          passwd=getValue(argsDict, "pass", "weblogic")
                          url=getValue(argsDict, "url", "t3://localhost:7001")
                          print "Connecting with [" + user + "," + passwd + "," + url + "]"
                          connect(user,passwd,url)
                            
                      ################################################################
                      #
                      # Retrieve a positional argument if it exists; if not,
                      # the provided default is returned.
                      #
                      # Params:
                      # pos   The integer location in sys.argv of the parameter
                      # default  The default value to return if the parameter does not exist
                      #
                      # returns the value at sys.argv[pos], or the provided default if necesssary
                      #
                      ################################################################
                      def getPositionalArgument(pos, default):
                        value=None
                        try:
                          value=sys.argv[pos]
                        except:
                          value=default
                        return value
                      
                      
                      ################################################################
                      #
                      # Main
                      #
                      ################################################################
                      
                      argsDict = argsToDict(sys.argv)
                      
                      redirectOutputFileName = getValue(argsDict, "redirectStdout")
                      if redirectOutputFileName is None:
                        pass
                      else:
                        redirect(redirectOutputFileName, 'false')
                        sys.stdout = open (redirectOutputFileName, "w")
                        
                      isHelp = getValue(argsDict, "help")
                      if isHelp is None:
                        pass
                      else:
                        print __doc__
                        exit()
                      
                      connectIfNecessary(argsDict)
                      
                      wlsServerName = getValue(argsDict, "wlsServerName", "examplesServer")
                      jmsServerName = getValue(argsDict, "jmsServerName", "examplesJMSServer")
                      jmsModuleName = getValue(argsDict, "jmsModuleName", "examples-jms")  
                      jmsDestinationName = getValue(argsDict, "jmsDestinationName", "exampleQueue") 
                      
                      # see the Message State table in whitepaper for bitmask information
                      # to create custom state masks (such as 'suspect' shown below), 
                      # by adding the individual state values (or appropriate bitwise ops)
                      messageStateString = getValue(argsDict, "messageState", "all")
                      if messageStateString == "all":
                        messageState = 2147483647
                      elif messageStateString == "suspect":
                        messageState = 1073741806 # ! (visible|ordered|deleted)
                      elif messageStateString == "visible":
                        messageState = 1
                      elif messageStateString == "ordered":
                        messageState = 16 # ordered invisible uoo
                      elif messageStateString == "delayed":
                        messageState = 32
                      elif messageStateString == "expired":
                        messageState = 64
                      elif messageStateString == "send transaction":
                        messageState = 10 # (send|transaction)
                      elif messageStateString == "receive transaction":
                        messageState = 12 # (receive|transaction)
                      elif messageStateString == "all transaction":
                        messageState = 14 # (send|receive|transaction)
                      else:
                        messageState = messageStateString
                      
                      messageFilter = getValue(argsDict, "messageFilter", "true")
                      elapsedTimeInSeconds = getValue(argsDict, "elapsedTimeInSeconds", "0")
                      
                      cursorTimeoutInSeconds = getValue(argsDict, "cursorTimeoutInSeconds", "close")
                      
                      printHeaders = getValue(argsDict, "printHeaders", "true")
                      printProperties = getValue(argsDict, "printProperties", "true")
                      printBody = getValue(argsDict, "printBody", "true")
                      
                      show_messages(wlsServerName, jmsServerName, jmsModuleName, jmsDestinationName, messageState, messageFilter, elapsedTimeInSeconds, cursorTimeoutInSeconds, printHeaders, printProperties, printBody)
                      
                      disconnect()
                      print 'End of script ...'
                      exit()
                      Edited by: Kats on Aug 10, 2009 5:39 PM
                      • 8. Re: Example using of getMessage(s) with JMS error queues?
                        714657
                        Thanks! That's absolutely great. Long. But great. I'm sure just about all the main bits of code there can be equated with parts of the java example, but I know I'd never be able to understand the flow and convert the language, as all this is a long way from my day job.