I don’t think you can do that. That’s a property for the session afaik. If you see an internal property with that name be careful as I’m not aware of any tests.
On Fri, Sep 30, 2022 at 4:16 PM John Lilley <john.lil...@redpointglobal.com.invalid> wrote: > Clebert, > > > > Thank for the reply! I can see how to see this for the connection by > adding this to the URL > > ?consumerWindowSize=0 > > > https://activemq.apache.org/components/artemis/documentation/1.1.0/flow-control.html > > > > I can also call setConsumerWindowSize(0) on the connection factory. > > > > Can I set this explicitly on a consumer instance after it is created? > > > > 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 3:02 AM > *To:* users@activemq.apache.org > *Subject:* Re: Processing only one message > > > > **** [Caution] This email is from an external source. Please use caution > responding, opening attachments or clicking embedded links. **** > > > > Look at slow consumers. Set consumer window size to 0 on this consumer. > > > > On Thu, Sep 29, 2022 at 6:01 PM John Lilley < > john.lil...@redpointglobal.com.invalid> wrote: > > We have an application that should read a single message from a queue (a > “job” queue) and then stop processing more messages. Think of it as a > “batch request”. This is entirely using the JMS driver. Is there a good > pattern for this? > > > > Under ActiveMQ 5, I call consumer.close(), session.close() from > onMessage() and that works fine. However, session.close() is not allowed > under Artemis (and maybe it was always wrong). > > > > I’ve tried calling only consumer.close(), and leave the session open. But > the message is not ACked. Explicitly calling message.acknowledge() doesn’t > work either, because it gets to >>> and individualAck is false: > > > > *public void *acknowledge() *throws *JMSException { > *if *(*session *!= *null*) { > *try *{ > *if *(*session*.isClosed()) { > *throw *ActiveMQClientMessageBundle.*BUNDLE*.sessionClosed(); > } > >>> *if *(*individualAck*) { > *message*.individualAcknowledge(); > } > > > > Going back to the original question, what is the recommended pattern for > this? > > > > Thanks > > john > > > > [image: rg] > <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,woI5c78_8f-DCJwnBAd2SB8ZQhLpa0H91b89ArK-kwPX0ToGxJQJmAWCo4pKKXorliMxDRxv9bVPLRhLdu50I9WBzrjdu8_-3xSL4nhKhbgAxC-hndfqanIBQp4,&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 > > 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