Can I inspect a JBoss JMS Queue? - java

I'm debugging an issue I've had with messages posted to a JMS Queue within JBoss 4.2.3. I know I can see the number of messages currently on the queue via the JMX-Console, but want to know if there's a way to get anymore information about the specific messages on the queue currently?
Is any of this available via JMX or can I enable any extra logging?
Or do I have to deploy something using a QueueBrowser?
Thanks,

You could use hermes jms, which is a JMS management console with a GUI. I haven't tried it with jboss (only with glassfish), but it was working pretty well and I was able to access the individual messages in the queue. Looks like they have a tutorial for jboss here: http://www.hermesjms.com/confluence/display/HJMS/JBoss+Tutorial

Related

WildFly 11 ActiveMQ Web Console

I am quite new to JMS. I know that WildFly 11 has a activeMQ JMS built inside it and we can certainly add a new ActiveMQ to it. But is there a way to get a web console for the inbuilt ActiveMQ, or is there a way inwhich we can monitor the JMS Queues and Topics like in a standalone ActiveMQ instance.
Thanks in advance.
PS:
Long story short, need to get a GUI interface that can intercept and show JMS messages.
Wildfly has a web console of its own which may suit your needs. It shows basic queue metrics like consumer count, message count, messages added, and scheduled count.
If you want a console that goes beyond that you might be able to deploy the console shipped with ActiveMQ Artemis to Wildfly (e.g. by copying the war files). However, I've not done this before so I don't know how well it would work.
Another option would be to deploy ActiveMQ Artemis standalone and use that instead of the instance of ActiveMQ Artemis embedded into Wildfly. This would give you easy, simple access to the web console shipped with ActiveMQ Artemis.

How to read jms queue statistics programmatically

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.
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.
There is no API for statistics in JMS spec. However you can use JMX to monitor the statistics.
From docs,
Monitoring JMS Servers
You can monitor statistics on active JMS servers defined in your
domain via the Administration Console or through the
JMSServerRuntimeMBean. JMS servers act as management containers for
JMS queue and topic resources within JMS modules that are specifically
targeted to JMS servers.
This post (new way) may be helpful.
JMS API doesn't provide such information. 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. For instance, IBM WebSphere MQ has such API.

How to manage messages in apache ActiveMQ

I have Apache ActiveMQ embedded into my java 8 server side project. Its working fine, and I am able to send and consume messages from pre-configured queues. I now need to be able programatically remove messages from the queue upon request. After reading some docs I found that Apache ActiveMQ has a sub-project called Artemis that seems to provide the required functionality. But I am a bit confused on how to do it. Is Artemis sort of plugin on top of ActiveMQ and I just need to add required dependencies and use the tools or is it a separate product and it doesn't work with Active MQ but as an independent product. If so how do I manage individual messages (in particular delete requested message) in Active MQ?
First off, 'ActiveMQ Artemis' is a sub-project within the ActiveMQ project that represents an entirely new broker with a radically different underlying architecture than the main ActiveMQ broker. You would run one or the other.
To manage messages in the ActiveMQ broker you would use the JMX Mamagement API and the Queue#remove methods it exposes to remove specific messages. This can be done using the Message ID or more broadly using a message selector to capture more than one message if need be. The JMX API is also exposed via Jolokia so that you can manage the broker via simple REST calls instead of the JMX way if you prefer.
In any case this sort of message level management on the broker is a bit of an anti-pattern in the messaging world. If you find yourself needing to treat the broker as a database then you should ask yourself why you aren't using a database since a broker is not a database. Often you will run into many more issues trying to manage your messages this way as opposed to just putting them into a database.

Run OpenJMS server as an embedded application

I have an application that needs to also be the JMS server (broker). So I would like to start within the same JVM the OpenJMS server. I have loosely read that this is possible, but I could not find any examples or explanation on the http://openjms.sourceforge.net site or anywhere else for that matter.
Has anyone done this, how simple is it? I know with HornetQ it is very simple but we want to remain with OpenJMS.
Thanks
Yes in HornetQ you could start an embedded jms server with only two line of code and a configuration xml.
Being that HornetQ is POJO based and opensource, why don't you choose it?
Piero.
You could also check more details on embedding HornetQ in the new HornetQ book
www.amazon.com/dp/1849518408/?tag=packtpubli-20

What do I need to realize notification using JMS?

I just need notification system. javax.jms.* - good solution I think, but I can't understand what do I need to use JMS?
I don't want to use any app. servers like GlassFish or Tomcat, I just would like to use standard jdk and myserver(very light) and myclient(very light too) and some MessageSystem to exchanging bitween myserver and myclient. As I understand to use JMS I need JMS Provider. For example: ActiveMQ. But I don't uderstand ActiveMQ needs any server?(GlassFish probably), and what kind of *.jar do I need from Java EE ?
JMS provider or more correctly a Message Broker can be a stand-alone application. Most of J2EE app servers include a broker inside them but yes we also have many very good stand alone JMS brokers, ActiveMQ is good, then there is OpenJMS and many others. And as they are stand alone they don't need another app server to run them. And they usually come with every needed jar as well :) SO you'll not need to copy any jar from other app-server to say ActiveMQ or OpenJMS.
ActiveMQ runs as a standalone server; it requires the Java VM like any Java application but nothing else beyond that.
Other stand alone JMS brokers (open source) which can be run standalone or even embedded in your Java application are Open Message Queue (OpenMQ) which is also included in GlassFish, and the new JBoss HornetQ message broker which will be the JMS implementation in JBoss application server.

Categories

Resources