Strange behaviour in HornetQ 2.2.2
black_ice_spa Feb 22, 2012 12:13 PMI dont know if this is a bug (and excuse me if its already posted, but with my limited english i couldnt explain it with enough acuraccy for a search), but i would like to know why this happens, its on hornetQ 2.2.2 (if this is not supossed to happen, ill test it on last version).
My main objetive is to build a debug-process which can delete a message by ID (i obtain id comparing toStrings via a browser and calling getJMSMessageID() of the Message), i cant control/enable JMX-MBeans and such on server (i'm wrong?, they wont ALLOW me to open jmx, so i can only use JMS classes and such, not mbeans nor jmx).
Having 100 messages whose toString() representation its "object70, object71, object72, object73...."
My ID is the one corresponding to message number 80(object80).
With this code (session is a normal session, non-transacted, auto-ack etc...) and colaLectura is my queue object:
int resul = 0;
System.out.println("Filter:" + filtro);
QueueReceiver recv = session.createReceiver(colaLectura, filtro);
while (recv.receiveNoWait() != null) {
Message m=recv.receiveNoWait(); <-- I know im calling this method twice and its not right, but well, you get the idea.
System.out.println("Got message with ID:" + m.getJMSMessageID() + "--> toString:" +((TextMessage)m).getText());
resul++;
}
recv.close();
return resul;
My output is this:
Filter:JMSMessageID='ID:75a17aaa-5d71-11e1-9c2a-001109ca9526'
Got message with ID:ID:75a17aaa-5d71-11e1-9c2a-001109ca9526 --> toString: objeto80
Got message with ID:ID:75a17aaa-5d71-11e1-9c2a-001109ca9526 --> toString: objeto80
Got message with ID:ID:75a17aaa-5d71-11e1-9c2a-001109ca9526 --> toString: objeto80
Got message with ID:ID:75a17aaa-5d71-11e1-9c2a-001109ca9526 --> toString:objeto80
Got message with ID:ID:75a17aaa-5d71-11e1-9c2a-001109ca9526 --> toString:objeto80
It returns 10 instances of my desired message, (there is only one on the queue of course), and all messages 70-80 disappear @ the queue (BUT, all except objeto80 one, are still there, messageCounter shows them, but i'll never be able to get them, unless i restart hornetq server). <-- Test is done on my own server, i cant access messageCounter on production machine.
Thanks for reading and/or answering,
PD: Any workaround-idea to delete message by ID without using jmx/mbeans removeMessage method? without consuming every message and re-sending all of them except the one i want to delete.