Since you mentioned "topic" the first thing I would recommend is getting a
better understanding of the broker's address model [1] because, technically
speaking, there's no such thing as a "topic" on the broker.

Next I would recommend looking through the management documentation [2] as
well as the JavaDocs for the management API [3].


Justin

[1]
https://activemq.apache.org/components/artemis/documentation/latest/address-model.html#address-model
[2]
https://activemq.apache.org/components/artemis/documentation/latest/management.html#management
[3]
https://activemq.apache.org/components/artemis/documentation/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/package-summary.html

On Thu, May 1, 2025 at 10:43 AM Niraj Kumar Rohit <nirajkumarro...@gmail.com>
wrote:

> Hi Justin
>
> I want to write my own api to get
> All queue
> All topic name
> Memory use by queue and topic
> No of messages queue  and topic
> Buffer memory
>
> I am using embbed  artemis in our application.
> So could u please guide me which api in artemis can I use to get  all
> imformation .
>
> Thank you
> Niraj
>
>
> On Tue, 15 Apr, 2025, 6:32 am Niraj Kumar Rohit, <
> nirajkumarro...@gmail.com>
> wrote:
>
> > Before we hav hornetq ,now we have to replace hornetq with artemis 2.19.1
> >
> > On Tue, 15 Apr, 2025, 12:22 am Justin Bertram, <jbert...@apache.org>
> > wrote:
> >
> >> To clarify, you have a legacy product using Java 8, and you're embedding
> >> ActiveMQ Artemis in it for the first time?
> >>
> >>
> >> Justin
> >>
> >> On Mon, Apr 14, 2025 at 11:42 AM Niraj Kumar Rohit <
> >> nirajkumarro...@gmail.com> wrote:
> >>
> >> > Hi Justin
> >> >
> >> > Using 2.19.1 because  product is legacy and it is on java 8.
> >> >
> >> > On Mon, 14 Apr, 2025, 6:42 pm Justin Bertram, <jbert...@apache.org>
> >> wrote:
> >> >
> >> > > > i want to  enable the web console in artemis 2.19.1.
> >> > >
> >> > > I answered a question similar to this on Stack Overflow [1] awhile
> >> back
> >> > > that should give you a good idea of what's needed.
> >> > >
> >> > > Aside from that, is there a specific reason you're using 2.19.1?
> That
> >> > > version was released in June of 2022 almost 3 years ago now. There
> >> have
> >> > > been 25 releases, over 2,300 commits, and hundreds of Jiras resolved
> >> > since
> >> > > then.
> >> > >
> >> > >
> >> > > Justin
> >> > >
> >> > > [1]
> >> > >
> >> > >
> >> >
> >>
> https://stackoverflow.com/questions/76670206/embedded-activemq-artemis-doesnt-show-web-console
> >> > >
> >> > > On Mon, Apr 14, 2025 at 2:25 AM Niraj Kumar Rohit <
> >> > > nirajkumarro...@gmail.com>
> >> > > wrote:
> >> > >
> >> > > > Hi  justin
> >> > > >
> >> > > > Thanks , I am able to achieve  HA  by xml  as well as   API also.
> I
> >> was
> >> > > > missing the connector  configuration.
> >> > > >
> >> > > >  New Requirement:-
> >> > > > i want to  enable the web console in artemis 2.19.1.  What are the
> >> > steps
> >> > > I
> >> > > > need to do.
> >> > > > I am using  embbededActivemq.java to start the artemis.
> >> > > >
> >> > > > Thanks
> >> > > > Niraj
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Wed, Apr 9, 2025 at 8:40 AM Justin Bertram <
> jbert...@apache.org>
> >> > > wrote:
> >> > > >
> >> > > > > In the code you shared I don't see any evidence that you're
> >> properly
> >> > > > > configuring your brokers to cluster. A pair of brokers using
> >> > > replication
> >> > > > > need a valid cluster to discover each other. This is noted in
> the
> >> > > > > documentation [1] which states, "A proper cluster configuration
> is
> >> > > > required
> >> > > > > as a pre-requisite for an HA configuration."
> >> > > > >
> >> > > > > Instead of attempting to configure the broker via the
> >> configuration
> >> > API
> >> > > > > would it be possible for you to put a broker.xml file on your
> >> > > classpath?
> >> > > > > That would save you a lot of time and effort, and it would be
> much
> >> > more
> >> > > > > flexible if you ever needed to change the configuration.
> >> > > > >
> >> > > > > In any case, take a look at one of the replicated examples [2]
> as
> >> a
> >> > > > > template for what you need to configure.
> >> > > > >
> >> > > > >
> >> > > > > Justin
> >> > > > >
> >> > > > > [1]
> >> > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> https://activemq.apache.org/components/artemis/documentation/latest/ha.html#ha-policies
> >> > > > > [2]
> >> > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> https://github.com/apache/activemq-artemis-examples/tree/main/examples/features/ha
> >> > > > >
> >> > > > > On Tue, Apr 8, 2025 at 9:07 PM Niraj Kumar Rohit <
> >> > > > > nirajkumarro...@gmail.com>
> >> > > > > wrote:
> >> > > > >
> >> > > > > > Hi
> >> > > > > >
> >> > > > > >
> >> > > > > > USE CASE:--
> >> > > > > > 1.We have one app which run in two server DP1 AND DP2
> >> > > > > > 2.Both DP1 and DP2 using embedded EmbeddedActiveMQ.java API to
> >> run
> >> > > > apache
> >> > > > > > activemq artemis.
> >> > > > > > 3.if i  start  DP1 1st then it is become live server and  DP2
> >> > become
> >> > > > > >  backup and vice versa
> >> > > > > > 4.Now i shutdown DP1  then  DP2 should live  and as i start
> DP1
> >> it
> >> > > > beahve
> >> > > > > > as backup  till DP2 not fail.
> >> > > > > > 5.in this case of artemis after fail of DP1,   DP2 is not
> >> behaving
> >> > > as
> >> > > > > live
> >> > > > > > server. because after failover of  DP1 , DP2 is not get
> >> activate .i
> >> > > am
> >> > > > > > checking  like this and always traped into loop nver come out
> >> from
> >> > > the
> >> > > > > > loop.
> >> > > > > >
> >> > > > > >  while
> >> > > > > >
> >> > > >
> >> >
> (!jmsServer.getActiveMQServer().waitForActivation(30L,TimeUnit.SECONDS))
> >> > > > > {
> >> > > > > >             Thread.sleep(100);
> >> > > > > >
> >> > > > > >         }
> >> > > > > > 6.API using for live and backup  server
> >> > > > > >
> >> > > > > >         if (isCurrentServerLive){
> >> > > > > >             ReplicatedPolicyConfiguration haPolicy = new
> >> > > > > > ReplicatedPolicyConfiguration();
> >> > > > > >             haPolicy.setGroupName("bsm-back-up-group");
> >> > > > > >             haPolicy.setInitialReplicationSyncTimeout(120000);
> >> > > > > >             haPolicy.setCheckForLiveServer(true);  // Critical
> >> for
> >> > > > > failover
> >> > > > > > detection
> >> > > > > >             haPolicy.setQuorumSize(1);  // Minimum nodes
> >> required
> >> > > > > >             configuration.setHAPolicyConfiguration(haPolicy);
> >> > > > > >          }else{
> >> > > > > >             ReplicaPolicyConfiguration haPolicy = new
> >> > > > > > ReplicaPolicyConfiguration();
> >> > > > > >             haPolicy.setGroupName("bsm-back-up-group");
> >> > > > > >             haPolicy.setInitialReplicationSyncTimeout(120000);
> >> > > > > >             haPolicy.setRestartBackup(false);  // Don't
> restart
> >> > when
> >> > > > live
> >> > > > > > exists
> >> > > > > >             haPolicy.setAllowFailBack(true);  // Allow primary
> >> to
> >> > > > resume
> >> > > > > >             configuration.setHAPolicyConfiguration(haPolicy);;
> >> > > > > >
> >> > > > > >           }
> >> > > > > >
> >> > > > > >
> >> > > > > > 7.even listern is also not getting  call , listner implemation
> >> in
> >> > > > backup
> >> > > > > > side
> >> > > > > > public void  registerListener(boolean isCurrentServerLive) {
> >> > > > > >         LOG.info("kutt registerListener
> >> > "+(!isCurrentServerLive?"back
> >> > > > > going
> >> > > > > > to register Listner":"live server not going to register"));
> >> > > > > >         if (!isCurrentServerLive) {
> >> > > > > >             final ActiveMQServer artemisServer =
> >> > > > > > jmsServer.getActiveMQServer();
> >> > > > > >             LOG.info(" registerListener done");
> >> > > > > >             artemisServer.registerActivateCallback(new
> >> > > > ActivateCallback()
> >> > > > > >
> >> > > > > >             {
> >> > > > > >                 @Override
> >> > > > > >                 public void preActivate() {
> >> > > > > >
> >> > > > > >                     LOG.info(" registerListener preActivate()
> >> > > called");
> >> > > > > >                 }
> >> > > > > >
> >> > > > > >                 @Override
> >> > > > > >                 public void deActivate() {
> >> > > > > >                     LOG.info(" registerListener deActivate()
> >> > > called");
> >> > > > > >                 }
> >> > > > > >
> >> > > > > >                 @Override
> >> > > > > >                 public void activationComplete() {
> >> > > > > >                     LOG.info(" registerListener
> >> > activationComplete()
> >> > > > > > called");
> >> > > > > >                 }
> >> > > > > >
> >> > > > > >
> >> > > > > >                 @Override
> >> > > > > >                 public void activated() {
> >> > > > > >                     LOG.info(" registerListener activated()
> >> > called");
> >> > > > > >
> >> > > > > >
> >> > > > > >                     // Below changes to check if the live bus
> is
> >> > > really
> >> > > > > > active.
> >> > > > > >                     // read the server state initially see the
> >> last
> >> > > > > > interval
> >> > > > > >                     // loop of 2 times of interval
> >> > > > > >                     // wait of interval for 1 second
> >> > > > > >                     // read the state and see if the state
> >> changes
> >> > > > > >                     // if there is change then without
> changing
> >> the
> >> > > > live
> >> > > > > > bus then restart
> >> > > > > >                     // if there is no change then update the
> >> live
> >> > > > server
> >> > > > > > and then restart
> >> > > > > >                     try {
> >> > > > > >                         long busState =
> >> busData.getServerState();
> >> > > > > >                         int maxChecks = 10;
> >> > > > > >                         boolean isLiveBusActive = false;
> >> > > > > >
> >> > > > > >                         synchronized (this) {
> >> > > > > >                             while (!isLiveBusActive &&
> >> (maxChecks >
> >> > > > 0)) {
> >> > > > > >                                 wait(1000L);
> >> > > > > >
> >> > > > > >                                 isLiveBusActive = (busState !=
> >> > > > > > busData.getServerState());
> >> > > > > >                                 LOG.info(" listerner called
> now
> >> on
> >> > > > > failover
> >> > > > > >  with state of backup"+isLiveBusActive);
> >> > > > > >                                 maxChecks--;
> >> > > > > >                             }
> >> > > > > >                         }
> >> > > > > >
> >> > > > > >                         if (!isLiveBusActive)
> >> > > > > >                             busData.setLiveServer(socket);
> >> > > > > >                     } catch (Exception e) {
> >> > > > > >                         LOG.info("Failed to update live server
> >> > after
> >> > > > > backup
> >> > > > > > server got activated", e);
> >> > > > > >                     }
> >> > > > > >
> >> > > > > >                     LOG.info("restarting backup server before
> >> > clients
> >> > > > > fail
> >> > > > > > over");
> >> > > > > >                      try{
> >> > > > > >                      HornetQRunner.main(new
> String[]{"strat"});
> >> > > > > >                      }catch(Exception e){
> >> > > > > >                          LOG.info("faled to satrt");
> >> > > > > >                     }
> >> > > > > >
> >> > > > > >                     // Throwing IllegalStateException to make
> >> sure
> >> > > the
> >> > > > > > calling old jmsserver doesn't finish it's failover
> >> > > > > >                     // since it had been stopped and a new one
> >> has
> >> > > been
> >> > > > > > started,
> >> > > > > >                     throw new IllegalStateException("Need to
> >> > restart
> >> > > > > > instead of activation");
> >> > > > > >                 }
> >> > > > > >             });
> >> > > > > >         }
> >> > > > > >
> >> > > > > >     }
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > i need your suggestion to make it work . and thanks in advance
> >> for
> >> > > your
> >> > > > > > help.
> >> > > > > >
> >> > > > > > its very urgent  our dead line is very near
> >> > > > > >
> >> > > > > > Thanks
> >> > > > > > Niraj
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
>

Reply via email to