I am trying to get the redelivery feature working. I am currently using 2.3.0.CR1 and in stand-alone/non-clustered mode.
I have setup Hornetq-configuration.xml as
<address-setting match="jms.queue.AC_NOTIFICATION_Q_1">
<redelivery-delay>3000</redelivery-delay>
<max-delivery-attempts>3</max-delivery-attempts>
</address-setting>
Code:
Setup :
sessionFactory.createSession(true, false);
consumer = session.createConsumer(new SimpleString(qname));
consumer.setMessageHandler(this);
session.start();
Handler :
public void onMessage(final ClientMessage message) {
HornetQBuffer readBytes = message.getBodyBuffer();
byte[] data = new byte[message.getBodySize()];
readBytes.readBytes(data);
try {
if ( false )
message.individualAcknowledge();
} catch (Exception e) {
logger.error("Unexcepted Exception while consuming message : " + e.getMessage());
}
}
I want to use sessions client acknowledge and message.individualAcknowledge().
I get the message only once and since I don't acknowledge the message I should have it redelivered again in 3 seconds as per the configuration in hornetq-configuration.xml.
I tried this using JMS API too and still redelivery does not happen. Using Jms API I create session using
connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
This not work either.
BTW, does redelivery work only with transacted sessions?
Thanks for your help.