简体   繁体   English

如何以编程方式读取jms队列统计信息

[英]How to read jms queue statistics programmatically

I found the following link to read messages from JMS Queue and its working. 我找到了以下链接来读取来自JMS Queue及其工作的消息。

https://blogs.oracle.com/soaproactive/entry/jms_step_3_using_the 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? 现在我想以编程方式读取JMS队列统计信息,如消息数,待处理消息数和消息输入/输出时间等。是否可以在weblogic或weblogic中为此提供任何API?

Please help. 请帮忙。

Statistics are part of a message broker implementation and thus vendor-specific. 统计信息是消息代理实现的一部分,因此也是特定于供应商的。 One popular implementations is ActiveMQ. 一个流行的实现是ActiveMQ。 It can be run in WebLogic Server or WebLogic Express . 可以在WebLogic Server或WebLogic Express中运行

Note: There are obviously many other JMS implementations around, and you should carefully evaluate for yourself which implementation suits your needs. 注意:显然有许多其他JMS实现,您应该仔细评估哪种实现适合您的需求。 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 从版本5.3开始,ActiveMQ附带统计插件

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 . ActiveMQ的另一个功能是咨询消息 Enable it in your broker's configuration and it 在您的代理配置中启用它

allows you to watch the system using regular JMS messages. 允许您使用常规JMS消息来查看系统。

In this way, you can passively react to certain events in the messaging system , eg when a queue exceeds some threshold. 通过这种方式,您可以被动地响应消息传递系统中的某些事件,例如,当队列超过某个阈值时。

There is no API for statistics in JMS spec. JMS规范中没有用于统计的API。 However you can use JMX to monitor the statistics. 但是,您可以使用JMX来监视统计信息。

From docs , 来自docs

Monitoring JMS Servers 监视JMS服务器

You can monitor statistics on active JMS servers defined in your domain via the Administration Console or through the JMSServerRuntimeMBean . 您可以通过管理控制台或JMSServerRuntimeMBean监视域中定义的活动JMS服务器的统计信息。 JMS servers act as management containers for JMS queue and topic resources within JMS modules that are specifically targeted to JMS servers. JMS服务器充当JMS模块中的JMS队列和主题资源的管理容器,这些资源专门针对JMS服务器。

This post (new way) may be helpful. 这篇文章 (新方式)可能会有所帮助。

JMS API doesn't provide such information. JMS API不提供此类信息。 It serves to receive and send messages, but isn't to grab statistics from underlying middleware. 它用于接收和发送消息,但不是从底层中间件获取统计信息。

Check direct API of the underlying MQ which you use. 检查您使用的基础MQ的直接API。 For instance, IBM WebSphere MQ has such API. 例如,IBM WebSphere MQ具有此类API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM