In my message queue contains several messages. This I want to group by specific properties. These all have a custom property "item-id"
This I would now certain values to: sports, movie ...
I do this like:
new MessageCreator() {
ObjectMessage message = session.createObjectMessage();
message.setObject(data);
message.setStringProperty("item-id", "sports");
}
This value is also displayed in the Queue at the Properties.
When I try to retrieve the messages which contain this property I get no result.
First trial:
Connection con = pc.createConnection();
Session sess =con.createSession(false,Session.AUTO_ACKNOWLEDGE);
AmqMessagesQueryFilter queryFilter = new AmqMessagesQueryFilter(pc, queue);
con.start();
String selector = "item-id = 'sports'";
List messages = queryFilter.query(selector);
But the list is empty
Second trial:
Connection con = pc.createConnection();
Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
AmqMessagesQueryFilter queryFilter = new AmqMessagesQueryFilter(pc, queue);
QueueBrowser queueBrowser = sess.createBrowser(queue,"item-id = 'sports'");
con.start();
List messages=Collections.list(queueBrowser.getEnumeration());
Also the list is empty.
What is my mistake?