-
1. Re: How do you "unacknowledge" a message?
drkirwin May 26, 2010 7:24 PM (in response to drkirwin)Interesting.
If I send 30 durable messages to a consumer (using the above), and I throw five exceptions (out of the thirty), I end up with 35 messages.
However, when I restart my consumer by killing the JVM and starting it up again, I get the remaining 5 messages.
How come they don't get resent "later"?
How to you set the time out for acknowledgement? (I'm using blockOnAcknowledge(true).)
Keith
-
2. Re: How do you "unacknowledge" a message?
drkirwin May 26, 2010 7:39 PM (in response to drkirwin)Okay, maybe this solves it?
try { doSomething(); msg.acknowledge(); } catch (Something s) { session.rollback(); }
That seems to work, actually.
-
3. Re: How do you "unacknowledge" a message?
clebert.suconic May 26, 2010 11:45 PM (in response to drkirwin)When you create the core session, you have two parameters you choose to create the session:
createSession(boolean autoCommitSends, boolean autoCommitAcks)
the auto-commit-ack means... they will get auto-committed...
if you use false.. you have to explicity call session.commit or session.rollback();
for autoCommitACKs there's also a third parameter you may choose:
createSession(boolean autoCommitSends, boolean autoCommitAcks, int ackBatchSize)
If you want ACKs to always be taken immediately, you have to set ackBatchSize = 0;
If you don't call ACK.. closing the consumer will also place the message back to the queue.