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!