Yes, you could definitely use a JMS QueueBrowser. I didn't mention it because you were already using the core API. If you used the core JMS client then the QueueBrowser implementation would use the core API's browse-only consumer under the covers. The advantage with using JMS is that it's an API and you can swap out implementations if you ever need/want to (e.g. if you switched brokers). The disadvantage is that it adds more dependencies to your code (although that might not be significant for your use-case).
Justin On Fri, Nov 4, 2022 at 2:03 PM John Lilley <john.lil...@redpointglobal.com.invalid> wrote: > Thanks! > > > > I also see that I could use a JMS QueueBrowser. Is there an advantage to > one over the other? > > > > John > > > > > [image: 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 <+1%207209385761> | john.lil...@redpointglobal.com > > *From:* Justin Bertram <jbert...@apache.org> > *Sent:* Friday, November 4, 2022 11:14 AM > *To:* users@activemq.apache.org > *Subject:* Re: Artemis: Enumerating messages without consuming them > > > > **** [Caution] This email is from an external source. Please use caution > responding, opening attachments or clicking embedded links. **** > > > > It is possible to browse the messages of a queue using the management API. > This is what the web console does when it displays the messages in a queue. > However, if you're using the core API then the most straight-forward way to > browse messages on a queue is with a browse-only consumer (e.g. using > o.a.a.a.a.c.c.ClientSession#createConsumer(SimpleString, boolean) [1]). > > > > > > Justin > > > > [1] > https://activemq.apache.org/components/artemis/documentation/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/client/ClientSession.html#createConsumer(org.apache.activemq.artemis.api.core.SimpleString,boolean) > > > > On Fri, Nov 4, 2022 at 11:54 AM John Lilley < > john.lil...@redpointglobal.com.invalid> wrote: > > In Artemis, using the management API (ClientRequestor, ManagementHelper), > is there a way to browse the contents of a queue without consuming the > messages? > > We need more than just the count, we actually need to examine each message. > > Thanks > > John > > > > [image: rg] > <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,Z61Xc09O-I4l27VHFnNq96QpcUBxTF0IYTj57GPq23UA6RGVQEBLOhtFqqI-eZuw77obzNkogzIlfFgJVP0IA8XntaV2HHUwkoVCSMw1pw,,&typo=1> > > *John Lilley * > > *Data Management Chief Architect, Redpoint Global Inc. * > > 888 Worcester Street, Suite 200 Wellesley, MA 02482 > > *M: *+1 7209385761 <+1%207209385761> | john.lil...@redpointglobal.com > > > 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. > > > 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. >