|Skip Navigation Links|
|Exit Print View|
|Oracle GlassFish Server Message Queue 4.5 Developer's Guide for Java Clients|
In order to consume and process a metrics messages, you must know its type and format. This section describes the general format of metrics messages and provides detailed information on the format of each type of metrics message.
Metrics messages are of type MapMessage. (A type of message whose body contains a set of name-value pairs. The order of entries is not defined.)
The message header has properties that are useful to applications. The type property identifies the type of metric message (and therefore its contents). It is useful if the same subscriber processes more than one type of metrics message for example, messages from the topics mq.metrics.broker and mq.metrics.jvm. The timestamp property indicates when the metric sample was taken and is useful for calculating rates or drawing graphs. The brokerHost, brokerPort, and brokerAddress properties identify the broker that sent the metric message and are useful when a single application needs to process metric messages from different brokers.
The body of the message contains name-value pairs, and the data values depend on the type of metrics message. The following subsections describe the format of each metrics message type.
Note that the names of name-value pairs (used in code to extract data) are case-sensitive and must be coded exactly as shown. For example, NumMsgsOut is incorrect; numMsgsOut is correct.
The messages you receive when you subscribe to the topic mq.metrics.broker have the type property set to mq.metrics.broker in the message header and have the data listed in Table 4-2 in the message body.
Table 4-2 Data in the Body of a Broker Metrics Message
The messages you receive when you subscribe to the topic mq.metrics.jvm have the type property set to mq.metrics.jvm in the message header and have the data listed in Table 4-3 in the message body.
Table 4-3 Data in the Body of a JVM Metrics Message
The message body contains a list of map names. Each destination on the broker is specified by a unique map name (a name-value pair) in the message body. The type of the name-value pair is hashtable.
The name (in the name-value pair) depends on whether the destination is a queue or a topic, and is constructed as follows:
The value (in the name-value pair) is an object of type java.util.Hashtable . This hashtable contains the key-value pairs described in Table 4-4.
Table 4-4 Value of a Name-Value Pair
Notice that the destination name and type could be extracted directly from the metrics topic destination name, but the hashtable includes it for your convenience.
By enumerating through the map names and extracting the hashtable described in Table 4-4, you can form a complete list of destination names and some of their characteristics.
The destination list does not include the following kinds of destinations:
Destinations that are used by Message Queue administration tools
Destinations that the Message Queue broker creates for internal use
The messages you receive when you subscribe to the topic mq.metrics.destination.queue.monitored_destination_name have the type property mq.metrics.destination.queue.monitored_destination_name set in the message header. The messages you receive when you subscribe to the topic mq.metrics.destination.topic.monitored_destination_name have the type property mq.metrics.destination.topic. monitored_destination_name set in the message header. Either of these messages has the data listed in Table 4-5 in the message body.
Table 4-5 Data in the Body of a Destination Metrics Message