The main thing to understand here is that broker management is based on JMX
MBeans. MBeans are available to manage essentially all of the broker's
resources (e.g. addresses, queues, bridges, acceptors, cluster-connections,
the broker itself, etc.). As required by JMX, each MBean has a unique name,
and these names follow a specific pattern and this pattern is hierarchical
for logical consistency and ease of use. For example, the broker's MBean
name follow the following pattern:

  org.apache.activemq.artemis:broker="<brokerName>"

Where <brokerName> is defined in broker.xml. Using the broker's name in the
MBean's name allows, for example, multiple brokers in the same JVM to be
managed via JMX.

Here are a couple other common patterns:

  - Address:
org.apache.activemq.artemis:broker="<brokerName>",component=addresses,address="<addressName>"
  - Queue:
org.apache.activemq.artemis:broker="<brokerName>",component=addresses,address="<addressName>",subcomponent=queues,routing-type="<routingType>",queue="<queueName>"

Once you know the name of the MBean you wish to interact with then you can
use the Jolokia protocol [1] to construct a URL to read attributes, write
attributes, or execute operations.

Hope that helps!


Justin

[1] https://jolokia.org/reference/html/protocol.html

On Thu, Mar 23, 2023 at 11:07 AM Thai Le <lnthai2...@gmail.com> wrote:

> Thank you for the reference, i checked them but still confused about how to
> navigate between different Control classes. As i understand, this url
>
> http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\
> "0.0.0.0\"/QueueNames
> mean to execute the getQueueNames method but how do I know that it is
> executing on the ActiveMQServerControl class? The AddressControl class also
> has the getQueueNames method. What if I want to see the message count in
> queue Q of address A? I tried something like this:
>
> http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\
> "0.0.0.0\"/Address/A/Queue/Q/MessageCount
> but it did not work. Also, is it possible to browse messages as web console
> does?
>
> Thai Le
>
> On Thu, 23 Mar 2023 at 00:47, Domenico Francesco Bruscino <
> bruscin...@gmail.com> wrote:
>
> > the partial list of the Management API MBeans is in the documentation[1],
> > i.e. to list the addresses you can use the getQueueNames method of
> > ActiveMQServerControl
> >
> > curl -v -H "Origin: http://localhost"; -u admin:admin
> >
> >
> http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\
> > "0.0.0.0\"/QueueNames
> >
> > To learn about all available management operations, see the Javadoc for
> > these interfaces[2]. They are located in the
> > org.apache.activemq.artemis.api.core.management package and they are
> named
> > with the word Control at the end.
> >
> > [1]
> >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/management.html#the-management-api
> > [2]
> >
> >
> https://activemq.apache.org/components/artemis/documentation/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/package-summary.html
> >
> > On Wed, 22 Mar 2023 at 22:56, Thai Le <lnthai2...@gmail.com> wrote:
> >
> > > Hi again,
> > > The example of the curl command to jolokia endpoint is fetching the
> > Version
> > > attribute of the org.apache.activemq.artemis:broker mbean, is there
> other
> > > mbean like address, queue, message that i can query?
> > >
> > > On Sat, 11 Mar 2023 at 11:28, Thai Le <lnthai2...@gmail.com> wrote:
> > >
> > > > I was actually looking for the management API, thanks for pointing
> out
> > > the
> > > > differences. I'll look into jolokia endpoint.
> > > >
> > > > Thai Le
> > > >
> > > > On Sat, Mar 11, 2023, 10:28 Justin Bertram <jbert...@apache.org>
> > wrote:
> > > >
> > > >> When you say "REST API" do you mean the REST *messaging* API or the
> > > >> REST-like *management* API?
> > > >>
> > > >> We still have the REST-like management API [1] which you can use to
> > get
> > > >> data from the broker like queue message counts, browse messages,
> etc.
> > > This
> > > >> API is provided via the Jolokia JMX-HTTP bridge which allows you to
> > > access
> > > >> the broker's JMX MBeans via HTTP.
> > > >>
> > > >>
> > > >> Justin
> > > >>
> > > >> [1]
> > > >>
> > > >>
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/management.html#exposing-jmx-using-jolokia
> > > >>
> > > >> On Sat, Mar 11, 2023 at 8:53 AM Thai Le <lnthai2...@gmail.com>
> wrote:
> > > >>
> > > >> > Thank you for the detail explanation. I was looking for a quick
> way
> > to
> > > >> get
> > > >> > info about queues (number of messages avail, peak some
> messages...)
> > > for
> > > >> > debugging purpose. I guess I just need to make an stand alone app
> > and
> > > >> use
> > > >> > Java client to get those info.
> > > >> >
> > > >> > Thai Le
> > > >> >
> > > >> > On Fri, Mar 10, 2023, 12:57 Justin Bertram <jbert...@apache.org>
> > > wrote:
> > > >> >
> > > >> > > As Robbie noted, the REST interface was removed in 2.26.0. You
> can
> > > >> find
> > > >> > the
> > > >> > > original discussion regarding removal here [1].
> > > >> > >
> > > >> > > As I understand it, here are the essential reasons for removing
> > it:
> > > >> > >  - The dependencies had fallen woefully out-of-date and nobody
> was
> > > >> > willing
> > > >> > > to put in the effort to fix them since there were some breaking
> > > >> changes
> > > >> > > along the way.
> > > >> > >  - The STOMP protocol is ubiquitous, simple, standardized, and
> can
> > > be
> > > >> > used
> > > >> > > in almost every circumstance and environment where REST might be
> > > used.
> > > >> > >  - REST messaging is not portable because there's no standard
> > > >> messaging
> > > >> > API
> > > >> > > for REST. This is generally bad for users as it locks them in
> to a
> > > >> > specific
> > > >> > > broker.
> > > >> > >  - For simple use-cases (e.g. basic send & receive) it's easy
> > these
> > > >> days
> > > >> > to
> > > >> > > create your own REST interface and then implement messaging
> behind
> > > >> that.
> > > >> > > Since the REST interface is in the user's control then
> portability
> > > >> isn't
> > > >> > an
> > > >> > > issue.
> > > >> > >  - It's a bit of a pain to set up as it requires manually
> > building a
> > > >> WAR
> > > >> > > file. This wasn't a great user experience and limited adoption.
> > > >> > >
> > > >> > > You are, of course, still free to use the REST interface WAR
> from
> > > >> 2.25.0
> > > >> > > with any newer version.
> > > >> > >
> > > >> > >
> > > >> > > Justin
> > > >> > >
> > > >> > > [1]
> > > https://lists.apache.org/thread/qcdg5r1ytf0scr05b9wxyxg0stxgs5pp
> > > >> > >
> > > >> > > On Thu, Mar 9, 2023 at 4:53 PM Thai Le <lnthai2...@gmail.com>
> > > wrote:
> > > >> > >
> > > >> > > > Hello,
> > > >> > > >
> > > >> > > > Does the REST API still exist in the latest version? I do not
> > see
> > > >> it in
> > > >> > > the
> > > >> > > > doc of 2.28.
> > > >> > > >
> > > >> > > > Regards
> > > >> > > >
> > > >> > > > Thai Le
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > >
> > > --
> > > Where there is will, there is a way
> > >
> >
>
>
> --
> Where there is will, there is a way
>

Reply via email to