That code formatting didn't work. Should have looked like: Destination destination = session.createQueue(queueName); String selector = propertyName + "='" + propertyValue + "'"; var consumer = session.createConsumer(destination, selector); Message message = null; while ((message = consumer.receive(PURGE_TIMEOUT_MS)) != null) {
result.add(message); } [rg] <https://www.redpointglobal.com/> John Lilley Data Management Chief Architect, Redpoint Global Inc. 34 Washington Street, Suite 205 Wellesley Hills, MA 02481 M: +1 7209385761<tel:+1%207209385761> | john.lil...@redpointglobal.com<mailto:john.lil...@redpointglobal.com> -----Original Message----- From: John Lilley <john.lil...@redpointglobal.com.INVALID<mailto:john.lil...@redpointglobal.com.INVALID>> Sent: Saturday, September 21, 2024 1:03 PM To: users@activemq.apache.org<mailto:users@activemq.apache.org> Subject: Clarification of JMS MessageConsumer.receive(timeout) *** [Caution] This email is from an external source. Please use caution responding, opening attachments or clicking embedded links. *** I am trying to build a utility for purging a queue of all messages matching a filter. The purpose is to remove “job start” messages that have been aborted before they were consumed and started. To this end I have code like: Destination destination = session.createQueue(queueName); String selector = propertyName + "='" + propertyValue + "'"; var consumer = session.createConsumer(destination, selector); Message message = null; while ((message = consumer.receive(PURGE_TIMEOUT_MS)) != null) { result.add(message); } I am unsure about PURGE_TIMEOUT_MS. I only care about messages that are already in the queue. Does this mean that receiveImmediately() would always get a message if one is in the queue? Or can there be a small delay while (I am guessing) some internal consumer waits for a message to be delivered asynchronously and then signals a semaphore? If so, how long should I wait to be sure? Thanks john [rg] <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,lsfwkEql83IPOLeWqWILFw4uHQCLzyhNeOHSBKhejgp733nKBeV7D7Kg0t7xr5jZoVEpp1zcMRYnFw3GT25IOJe79-bkOIYJOPKagSnH0NT4THotQQ,,&typo=1> John Lilley Data Management Chief Architect, Redpoint Global Inc. 34 Washington Street, Suite 205 Wellesley Hills, MA 02481 M: +1 7209385761<tel:+1%207209385761> | john.lil...@redpointglobal.com<mailto:john.lil...@redpointglobal.com><mailto:john.lil...@redpointglobal.com<mailto: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.
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org For additional commands, e-mail: users-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact