High Quality JMS Messaging.

View Messages [view]

Syntax:

    view <queuename> <startidx> (<stopidx>|*) [<selector>] [truncate <n>]

Views messages of a queue. The command is available in context "/sys$queuemanager/usage". The command parameters are the start index, stop index, an optional message selector, and an optional truncate size. The start and stop index just specify the message numbers in the result set. The result set is equal to the queue content. If a message selector is specified, the result set may be reduced. The index starts at 0 and is inclusively, for example, a start index of 0 and a stop index of 10 displayes 11 messages, if available. If the stop index is greater than the result size, messages are displayed until the result size is reached. If "*" is specified as the stop index, all messages are displayed, starting from the start index. Because the message body might be quite large, it is truncated by default to 2048 characters for text and object messages. This truncation takes also place for stream, bytes, and map messages, however, it will only applied to byte array items. The truncate size can be adjusted by specified the optional "truncate <n>" parameter.

Output Format

The output format is XML. The result set is covered by an XML element "<result>". Sub-elements are "<message>" elements. A "<message>" element contains the following sub-elements:

A javax.jms.TextMessage contains the text inside the <body> element.

Example:

     <body>Moin, Moin!</body>

A javax.jms.ObjectMessage contains the result of the toString() method inside the <body> element. If toString() fails due to a ClassNotFoundException, the body contains a resp. error message.

Example:

     <body>This is a StringBuffer!</body>

A javax.jms.BytesMessage adds an attribute "body-length" to the <body> element which contains the unsigned byte values.

Example:

    <body body-length="56">{1,0,1,255,1,2,3,6,7,0,65,0,66,64,89,6,102,
    102,102,102,102,64,128,0,0,0,0,0,200,0,0,0,0,0,0,1,44,64,75,192,0,0,0,0,
    0,0,60,0,7,83,116,114,105,110,103,49}</body>

A javax.jms.StreamMessage contains "<stream-item>" sub-elements.

Example:

    <body>
      <stream-item type="java.lang.Boolean" value="true"/>
      <stream-item type="java.lang.Boolean" value="false"/>
      <stream-item type="java.lang.Byte" value="1"/>
      <stream-item type="java.lang.Byte" value="255"/>
      <stream-item type="[B" value="{1,2,3}"/>
      <stream-item type="[B" value="{6,7}"/>
      <stream-item type="java.lang.Character" value="A"/>
      <stream-item type="java.lang.Character" value="B"/>
      <stream-item type="java.lang.Double" value="100.1"/>
      <stream-item type="java.lang.Float" value="4.0"/>
      <stream-item type="java.lang.Integer" value="200"/>
      <stream-item type="java.lang.Long" value="300"/>
      <stream-item type="java.lang.Double" value="55.5"/>
      <stream-item type="java.lang.Short" value="60"/>
      <stream-item type="java.lang.String" value="String1"/>
    </body>

A javax.jms.MapMessage contains "<item>" sub-elements.

Example:

    <body>
      <item name="P1" type="java.lang.Boolean" value="true"/>
      <item name="P10" type="java.lang.Float" value="4.0"/>
      <item name="P11" type="java.lang.Integer" value="200"/>
      <item name="P12" type="java.lang.Long" value="300"/>
      <item name="P13" type="java.lang.Short" value="60"/>
      <item name="P14" type="java.lang.String" value="String1"/>
      <item name="P2" type="java.lang.Boolean" value="false"/>
      <item name="P3" type="java.lang.Byte" value="1"/>
      <item name="P4" type="java.lang.Byte" value="255"/>
      <item name="P5" type="[B" value="{1,2,3}"/>
      <item name="P6" type="[B" value="{6,7}"/>
      <item name="P7" type="java.lang.Character" value="A"/>
      <item name="P8" type="java.lang.Character" value="B"/>
      <item name="P9" type="java.lang.Double" value="100.1"/>
    </body>

Usage Examples

View all messages of queue "t0":

Example:

    router1/sys$queuemanager/usage> view t0 0 *

    <?xml version="1.0" encoding="UTF-8"?>
    <result>
      <message index="0" message-key="0" type="BytesMessage">
        <jms-header>
          <JMSDeliveryMode>NON_PERSISTENT</JMSDeliveryMode>
          <JMSDestination>t0@router1</JMSDestination>
          <JMSExpiration>0</JMSExpiration>
          <JMSMessageID>ID:MUELLI/192.168.120.254-10276083552300</JMSMessageID>
          <JMSPriority>4</JMSPriority>
          <JMSRedelivered>false</JMSRedelivered>
          <JMSTimestamp>1027608355230</JMSTimestamp>
        </jms-header>
        <jmsx-header>
          <JMSXUserID>anonymous</JMSXUserID>
        </jmsx-header>
        <jms-vendor-properties/>
        <message-properties>
          <property name="Boolean1" type="java.lang.Boolean" value="true"/>
          <property name="Boolean2" type="java.lang.Boolean" value="false"/>
          <property name="Byte1" type="java.lang.Byte" value="1"/>
          <property name="Byte2" type="java.lang.Byte" value="7"/>
          <property name="Double1" type="java.lang.Double" value="222.22"/>
          <property name="Double2" type="java.lang.Double" value="888.88"/>
          <property name="Float1" type="java.lang.Float" value="4.0"/>
          <property name="Float2" type="java.lang.Float" value="10.0"/>
          <property name="Int1" type="java.lang.Integer" value="4"/>
          <property name="Int2" type="java.lang.Integer" value="10"/>
          <property name="Long1" type="java.lang.Long" value="5"/>
          <property name="Long2" type="java.lang.Long" value="11"/>
          <property name="Short1" type="java.lang.Short" value="6"/>
          <property name="Short2" type="java.lang.Short" value="12"/>
          <property name="String1" type="java.lang.String" value="StringValue1"/>
          <property name="String2" type="java.lang.String" value="StringValue2"/>
        </message-properties>
        <body body-length="56">{1,0,1,255,1,2,3,6,7,0,65,0,66,64,89,6,102,102,102,10
    2,102,64,128,0,0,0,0,0,200,0,0,0,0,0,0,1,44,64,75,192,0,0,0,0,0,0,60,0,7,83,116,
    114,105,110,103,49}</body>
      </message>
      <message index="1" message-key="1" type="StreamMessage">
        <jms-header>

        ... (etc, snipped)

      </message>
    </result>
    <!-- 6 messages displayed, 6 messages total in queue -->
    <!-- If necessary, message body [partly] truncated to 2048 characters -->

    router1/sys$queuemanager/usage>_

View all messages of queue "t0" but truncate the body output to 20.

Example:

    router1/sys$queuemanager/usage> view t0 0 * truncate 20

    <?xml version="1.0" encoding="UTF-8"?>
    <result>
      <message index="0" message-key="0" type="BytesMessage">
        <jms-header>
          <JMSDeliveryMode>NON_PERSISTENT</JMSDeliveryMode>
          <JMSDestination>t0@router1</JMSDestination>
          <JMSExpiration>0</JMSExpiration>
          <JMSMessageID>ID:MUELLI/192.168.120.254-10276083552300</JMSMessageID>
          <JMSPriority>4</JMSPriority>
          <JMSRedelivered>false</JMSRedelivered>
          <JMSTimestamp>1027608355230</JMSTimestamp>
        </jms-header>
        <jmsx-header>
          <JMSXUserID>anonymous</JMSXUserID>
        </jmsx-header>
        <jms-vendor-properties/>
        <message-properties>
          <property name="Boolean1" type="java.lang.Boolean" value="true"/>
          <property name="Boolean2" type="java.lang.Boolean" value="false"/>
          <property name="Byte1" type="java.lang.Byte" value="1"/>
          <property name="Byte2" type="java.lang.Byte" value="7"/>
          <property name="Double1" type="java.lang.Double" value="222.22"/>
          <property name="Double2" type="java.lang.Double" value="888.88"/>
          <property name="Float1" type="java.lang.Float" value="4.0"/>
          <property name="Float2" type="java.lang.Float" value="10.0"/>
          <property name="Int1" type="java.lang.Integer" value="4"/>
          <property name="Int2" type="java.lang.Integer" value="10"/>
          <property name="Long1" type="java.lang.Long" value="5"/>
          <property name="Long2" type="java.lang.Long" value="11"/>
          <property name="Short1" type="java.lang.Short" value="6"/>
          <property name="Short2" type="java.lang.Short" value="12"/>
          <property name="String1" type="java.lang.String" value="StringValue1"/>
          <property name="String2" type="java.lang.String" value="StringValue2"/>
        </message-properties>
        <body body-length="56">{1,0,1,255,1,2,3,6,7,0,65,0,66,64,89,6,102,102,102,10
    2...(truncated)}</body>
      </message>
      <message index="1" message-key="1" type="StreamMessage">
        <jms-header>

        ... (etc, snipped)

      </message>
    </result>
    <!-- 6 messages displayed, 6 messages total in queue -->
    <!-- If necessary, message body [partly] truncated to 2048 characters -->

    router1/sys$queuemanager/usage>_

View messages 5 to 10 of queue "t0" but truncate the body output to 20 and use a message selector:

Example:

    router1/sys$queuemanager/usage> view t0 0 * "Double2 between 800 and 900" truncate 20

    (result snipped)

    router1/sys$queuemanager/usage>_

Redirect the output to a file "t0.xml" and pump all messages of queue "t0" into that file for further processing:

Example:

    router1/sys$queuemanager/usage> output t0.xml
    router1/sys$queuemanager/usage> view t0 0 *
    router1/sys$queuemanager/usage> output console
    router1/sys$queuemanager/usage>_