Thanks!



[rg] <https://www.redpointglobal.com/>

John Lilley

Data Management Chief Architect, Redpoint Global Inc.

888 Worcester Street, Suite 200 Wellesley, MA 02482

M: +1 7209385761<tel:+1%207209385761> | 
john.lil...@redpointglobal.com<mailto:john.lil...@redpointglobal.com>
From: Justin Bertram <jbert...@apache.org>
Sent: Tuesday, November 8, 2022 9:43 PM
To: users@activemq.apache.org
Subject: Re: Artemis management API: getting message counts

*** [Caution] This email is from an external source. Please use caution 
responding, opening attachments or clicking embedded links. ***

Currently there's no way to differentiate between “queue does not exist” and 
other errors due to the way the broker handles the underlying exception when 
retrieving the attribute's value. However, you can use the createQueue method 
of ClientSession with some exception handling before you invoke the management 
operation to ensure the queue exists, e.g.:

      try {
         session.createQueue(new QueueConfiguration(queueName));
      } catch (ActiveMQQueueExistsException e) {
         // ignore
      }

The createQueue and createTopic methods on the JMS Session object just 
instantiate a local object of the respective type. This is noted in the JavaDoc 
[1]:

  > Note that this method simply creates an object that encapsulates the name 
of a queue. It does not create the physical queue in the JMS provider.


Justin

[1] 
https://docs.oracle.com/javaee/7/api/javax/jms/Session.html#createQueue-java.lang.String-<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fdocs.oracle.com%2fjavaee%2f7%2fapi%2fjavax%2fjms%2fSession.html%23createQueue-java.lang.String-&c=E,1,eBSUMKUo2cEv4_WzMfG4zuUIElhIpAHYzabqFrnk89_CG9bFTNGKz8IVequJ74JmusfPxVX9MLKAbSBddKMAKKDAG5PmePqm-SJZHgYc-ASbkVy-ywOEgQ,,&typo=1>

On Fri, Nov 4, 2022 at 5:17 PM John Lilley 
<john.lil...@redpointglobal.com.invalid<mailto:john.lil...@redpointglobal.com.invalid>>
 wrote:
I’ve also tried ensuring that a queue exists, by creating the queues we will 
use.
However, it looks like the JMS call to Session.createQueue() doesn’t really 
create the queue.  Are queues created lazily?  Is there a way to force queue 
creation?
Thanks
john



[rg]<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,2fRZrXW99mVcjB_2eBw6FDQjMKIwj506mBu8I3SICX8kRLObkQrDntYw6aOhuZnCACbVoH-UCcKoa6VLZAi9Av8DwkCU9LgiHGFmFOctV36XdgVqbySs&typo=1>

John Lilley

Data Management Chief Architect, Redpoint Global Inc.

888 Worcester Street, Suite 200 Wellesley, MA 02482

M: +1 7209385761<tel:+1%207209385761> | 
john.lil...@redpointglobal.com<mailto:john.lil...@redpointglobal.com>
From: John Lilley 
<john.lil...@redpointglobal.com.INVALID<mailto:john.lil...@redpointglobal.com.INVALID>>
Sent: Friday, November 4, 2022 3:10 PM
To: users@activemq.apache.org<mailto:users@activemq.apache.org>
Subject: Artemis management API: getting message counts

*** [Caution] This email is from an external source. Please use caution 
responding, opening attachments or clicking embedded links. ***

Greetings,

To get the message count of a queue using the Artemis management API, we are 
doing

ClientMessage request = clientSession.createMessage(false);
ManagementHelper.putAttribute(request, ResourceNames.QUEUE + queueName, 
“MessageCount”);
ClientMessage reply = client.request(request);
if (ManagementHelper.hasOperationSucceeded(reply)) { … }
This works, but fails if the queue doesn’t exist.  How can I tell the 
difference between “queue does not exist” and other errors?  Do I need to make 
a separate call to determine existence?

Thanks
John



<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

John Lilley 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

Data Management Chief Architect, Redpoint Global Inc. 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

888 Worcester Street, Suite 200 Wellesley, MA 02482 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

M: +1 7209385761 | john.lil...@redpointglobal.com 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is confidential 
and is intended solely for the use of the individual(s) to whom it is 
addressed. If you believe you received this e-mail in error, please notify the 
sender immediately, delete the e-mail from your computer and do not copy, print 
or disclose it to anyone else. If you properly received this e-mail as a 
customer, partner or vendor of Redpoint, you should maintain its contents in 
confidence subject to the terms and conditions of your agreement(s) with 
Redpoint. 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is confidential 
and is intended solely for the use of the individual(s) to whom it is 
addressed. If you believe you received this e-mail in error, please notify the 
sender immediately, delete the e-mail from your computer and do not copy, print 
or disclose it to anyone else. If you properly received this e-mail as a 
customer, partner or vendor of Redpoint, you should maintain its contents in 
confidence subject to the terms and conditions of your agreement(s) with 
Redpoint. 
<https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,p_NHR3a86dR1b6KlO21SbnJU-TNYVbsUl7-SSqKmaTT4lFJEiA1qulR_3Qi6v5uvBhPC0wMOd0jueDbLvHHWVKG70a9fU1BwXahcuC7C&typo=1>

PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is confidential 
and is intended solely for the use of the individual(s) to whom it is 
addressed. If you believe you received this e-mail in error, please notify the 
sender immediately, delete the e-mail from your computer and do not copy, print 
or disclose it to anyone else. If you properly received this e-mail as a 
customer, partner or vendor of Redpoint, you should maintain its contents in 
confidence subject to the terms and conditions of your agreement(s) with 
Redpoint.

Reply via email to