[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: DeliveryCount & ACKs (Repost)
clebert.suconic@jboss.com
do-not-reply at jboss.com
Wed Feb 18 13:30:04 EST 2009
If we decrement the delivery counter on cancelRefs, we are back to the original issue (The first post on this thread).
I have locally done the change, and the issue happened again as I predicted.
Another way to fix this would be to make autoCommitAcks = false (as somewhat suggested on JBMESSAGING-1294), and make the JMSWrappers to call Session.commit() when a message is received. I tried that as a quick fix and I could fix the test, however I got a few other issues on the DupsOK.
And I also see performance issues with this, as we would make a Commit call on *ever* message received on the AUTO_ACK.
Just to make a record about what's the current issue. The parts in bold are the executed parts when the Session is AUTO_ACK. The message is aways acknowledged after listener.onMessage was called on the AUTO_ACK case:
|
| public void onMessage(final ClientMessage message)
| {
|
| JBossMessage jbm = JBossMessage.createMessage(message, session.getCoreSession());
|
| try
| {
| jbm.doBeforeReceive();
| }
| catch (Exception e)
| {
| log.error("Failed to prepare message for receipt", e);
|
| return;
| }
|
| if (transactedOrClientAck)
| {
| try
| {
| message.acknowledge();
| }
| catch (MessagingException e)
| {
| log.error("Failed to process message", e);
| }
| }
|
| try
| {
| listener.onMessage(jbm);
| }
| catch (RuntimeException e)
| {
| //See JMS 1.1 spec, section 4.5.2
|
| log.warn("Unhandled exception thrown from onMessage", e);
|
| if (!transactedOrClientAck)
| {
| try
| {
| session.getCoreSession().rollback();
|
| session.setRecoverCalled(true);
|
| }
| catch (Exception e2)
| {
| log.error("Failed to recover session", e2);
| }
| }
| }
|
| if (!session.isRecoverCalled())
| {
| try
| {
| //We don't want to call this if the consumer was closed from inside onMessage
| if (!consumer.isClosed() && !this.transactedOrClientAck)
| {
| message.acknowledge();
| }
| }
| catch (MessagingException e)
| {
| log.error("Failed to process message", e);
| }
| }
|
| session.setRecoverCalled(false);
| }
|
|
We need to be able to rollback the current message, so the counter are set correctly.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211233#4211233
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211233
More information about the jboss-dev-forums
mailing list