I would not use a listener for a consumer that will only receive a single message anyways.
On Fri, Sep 30, 2022 at 9:46 AM John Lilley <john.lil...@redpointglobal.com.invalid> wrote: > Clebert, > > Thanks for the reply. I’ll try your suggestion. > > I’m not closing the consumer specifically to clear the prefetch buffer; > rather I’m closing the consumer to stop receiving more messages. The > existence of pre-fetch messages is undesirable in that case, because (1) as > you point out it is an anti-pattern, and (2) a process that fails to close > its consumer in a timely fashion will hog the prefetched messages and > prevent others from processing them. > > john > > > > > [image: rg] <https://www.redpointglobal.com/> > > John Lilley > > Chief Architect, Redpoint Global Inc. > > 888 Worcester Street, Suite 200 Wellesley, MA 02482 > <https://www.google.com/maps/search/888+Worcester+Street,+Suite+200+Wellesley,+MA+02482?entry=gmail&source=g> > > *M: *+1 7209385761 <+1%207209385761> | john.lil...@redpointglobal.com > > *From:* Clebert Suconic <clebert.suco...@gmail.com> > *Sent:* Friday, September 30, 2022 6:12 AM > *To:* users@activemq.apache.org > *Subject:* Re: Disabling prefetch > > > > **** [Caution] This email is from an external source. Please use caution > responding, opening attachments or clicking embedded links. **** > > > > BTW closing a consumer to clear the fetched buffer is an anti pattern > either AMQ5 or Artemis. Set no prefetch or any slow consumer option > instead. That would be a waste of network and CPU. > > > > On Fri, Sep 30, 2022 at 4:33 AM Clebert Suconic <clebert.suco...@gmail.com> > wrote: > > > > This is done by setting consumerWindowSize to 0 in your connections. > > > > There a note about slow consumers in the documentation. I’m on the phone > now and I can’t get you a link. If you can’t find it let me know and I > will post it for you. > > > > On Thu, Sep 29, 2022 at 6:13 PM John Lilley < > john.lil...@redpointglobal.com.invalid> wrote: > > Related to my previous post (“Processing only one message”), under AMQ 5 > I’ve had to disable prefetch to prevent a “batch server” from hogging > messages for a while until it is done and closes the consumer/session (at > which point the un-ACKed messages are delivered to other servers). This > was done by decorating the queue name: > > *if *(*disablePrefetch*) { > > *// See https://activemq.apache.org/what-is-the-prefetch-limit-for > <https://activemq.apache.org/what-is-the-prefetch-limit-for> *queueName > = queueName + *"?consumer.prefetchSize=1"*; > } > > > > I am unsure, but I suspect this approach doesn’t work for Artemis. What > should I do instead? Or maybe the answer to my previous post will make > this moot. > > > > Thanks > > john > > > > [image: rg] > <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,hbQyfJtTMCieiIHykTGmwi6tO8ENrzRddQJGtbFXCn09SaXzIi4bTZ-k2ZKCO8_1ie7GilmyfctL16AHUZuCaG1pRT2EnX88GqNIeVwNBvjfg5oj&typo=1> > > *John Lilley * > > *Chief Architect, Redpoint Global Inc. * > > 888 Worcester Street, Suite 200 Wellesley, MA 02482 > <https://www.google.com/maps/search/888+Worcester+Street,+Suite+200+Wellesley,+MA+02482?entry=gmail&source=g> > > *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. > > -- > > Clebert Suconic > > -- > > Clebert Suconic > > 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. > -- Clebert Suconic