The QueueMonitor moves through a specified set of queues, listing the active messages it finds as it examines each queue. In the examples to this point, the Talk samples left no messages in any queue.
The monitor samples each open GUI windows that provide a scrolling array of its contents. The nature of the two monitors underscores fundamental differences between the Publish and Subscribe messaging model and the Point-to-point messaging model. The differences between MessageMonitor and QueueMonitor are as follows:
What messages are displayed?
MessageMonitor: Delivered.
QueueMonitor: Undelivered.
When does the display update?
MessageMonitor: When a message is published to a subscribed topic, it is added to the displayed list.
QueueMonitor: When you click the Browse Queues button, the list is refreshed.
When does the message go away?
MessageMonitor: When the display is cleared for any reason.
QueueMonitor: When the message is delivered (or when it expires).
What happens when the broker and monitor are restarted?
MessageMonitor: As messages are listed at the moment they are delivered, there are no messages in the
MessageMonitoruntil new deliveries occur.QueueMonitor: Listed messages marked
PERSISTENTare stored in the broker persistent storage mechanism. They are redisplayed when the broker and the QueueMonitor restart and then choose to browse queues.
To run the QueueMonitor sample do the following:
In window 1, enter
ant talk1.In window 3, enter
ant qmonitor.The
QueueMonitors console window lists the queues that have been specified for it to browse.The QueueMonitor Java window opens.
Click .
The messages in the queue at the moment it is browsed are listed. If you are following along carefully, there should be no messages in any queue.
To put messages into a queue do the following:
In window 1 (where
Talker1is running), type1and then press Enter.Repeat step 1 to create a few messages, such as
2Enter,3Enter,4Enter.In the QueueBrowser window, click .
The messages are in the queue. They will continue to be there until a receiver receives them on that queue, or they expire (set to 30 minutes by the sender).
The messages that are waiting on the queue will get delivered to the next receiver that chooses to receive from that queue.
To receive the queued messages do the following:
In window 2, enter
ant talk2.When the Talker_2 application opens, it shows that it consumes the messages in the queue in sequence.
In the QueueBrowser window, click .
The queues are all empty. As long as you have receivers on the sample queues, no messages will display in the QueueMonitor window.








