Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read jms queue statistics programmatically

Tags:

java

jms

weblogic

I found the following link to read messages from JMS Queue and its working.

https://blogs.oracle.com/soaproactive/entry/jms_step_3_using_the

Now I want to read JMS queue statistics programmatically like number of messages, number of pending messages and message in/out time etc. Is it possible in weblogic or weblogic provide any API for this purpose?

Please help.

like image 657
Sunil Singh Bora Avatar asked Dec 23 '16 08:12

Sunil Singh Bora


People also ask

What is consumer count in JMS queue?

consumer-count The number of consumers consuming messages from this queue.

How do I monitor JMS queues?

In the Administration Console, expand Services > Messaging > JMS Modules. In the JMS Modules table, click the JMS module that contains the configured queue that you want to access. In the selected JMS module's Summary of Resources table, click the queue that you want to monitor. Click the Monitoring > Statistics tab.

Is JMS a FIFO?

The JMS IQ Manager is set to fully concurrent FIFO processing. However, each Collaboration on each integration server retrieves messages as they come in, and is able to commit them unrestricted to the queue.

How do I get messages from JMS queue?

The parameter destination is a Queue or Topic object that the application has created previously. The application then uses the receive() method of the MessageConsumer object to receive a message from the destination, as shown in the following example: Message inMessage = consumer. receive(1000);


1 Answers

Statistics are part of a message broker implementation and thus vendor-specific. One popular implementations is ActiveMQ. It can be run in WebLogic Server or WebLogic Express.

Note: There are obviously many other JMS implementations around, and you should carefully evaluate for yourself which implementation suits your needs. Nevertheless, I shall use it as an example to point out the relevant features for your case:

Beginning with version 5.3, ActiveMQ ships with a statistics plugin

that can be used to retrieve statistics from the broker or its destinations.

You should be able to actively poll statistics from within your code by sending messages to specific destinations within the broker, see linked documentation for details.

Another feature of ActiveMQ is Advisory messages. Enable it in your broker's configuration and it

allows you to watch the system using regular JMS messages.

In this way, you can passively react to certain events in the messaging system , e.g. when a queue exceeds some threshold.

like image 131
swiedenfeld Avatar answered Oct 23 '22 01:10

swiedenfeld