Solace Community is getting a facelift!
On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.
We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!
Selector on Browser, how to do?

Hi all,
I try to filter a specific message of a queue I want to delete (I have the message ID from a call before).
How to set the selector?
this is my code and I tried a lot of variations on the selector
for example
mi = '485'
mi = 485
JMSMessageID = 485
JMSMessageID = '485'
etc.
when I browse via the console and select a message the only parameter is the message ID so what is the actual call (with java) to delete that message?
below my java code:
public Boolean DeleteMessageWithBrowser(String destination, int waitTimeout, String messageId) { try { session = JCSMPFactory.onlyInstance().createSession(properties); session.connect(); queue = JCSMPFactory.onlyInstance().createQueue(destination); BrowserProperties br_prop = new BrowserProperties(); br_prop.setEndpoint(queue); br_prop.setTransportWindowSize(1); br_prop.setSelector("mi = '"+messageId+"'"); br_prop.setWaitTimeout(waitTimeout); Browser myBrowser = session.createBrowser(br_prop); myBrowser.remove(myBrowser.getNext()); myBrowser.close(); } catch (JCSMPException e) { _logNode.debug("Error when getting message, session close. Error: "+e.getMessage()); if( session != null && !session.isClosed() ) { session.closeSession(); } } finally { if( session != null && !session.isClosed() ) { _logNode.debug("Message browsed. Exiting."); session.closeSession(); } } return true; }
thx!
Comments
-
I have the same issue.
I also tried the JMS messaging api like this:
jmsTemplate.browseSelected(queueToBrowse, selector, (session, browser) -> { Enumeration<SolMessage> enumeration = browser.getEnumeration(); …
with
selector
using the same key values "mi" or "JMSMessageID" but none of them are working.It seems the JMS Header is not automatically set with the internal message Id when I check with JMS Toolbox.
If anyone has a solution (jcmp or jms) it would be nice.
0