[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - JMSMessage.ack call is equivalent to JMSSession.commit()

clebert.suconic@jboss.com do-not-reply at jboss.com
Wed Mar 25 19:10:45 EDT 2009


Say.. you have a JMS Session, transacted...


  |          Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
  |          MessageConsumer consumer = consumerSess.createConsumer(queue1);
  |          conn.start();
  | 

 
Say, an user now being aware of what he is doing calls message.acknowledge();

         int count = 0;
  |          while (true)
  |          {
  |             Message m = consumer.receive(200);
  |             if (m == null)
  |             {
  |                break;
  |             }
  |             m.acknowledge();  // This is invalid, but I guess we should just ignore this call 
  |             count++;
  |          }
  | 


ATM, a subsequent call to rollback is useless, as m.acknowledge already fired a transaction commit.

Message javadoc states we should ignore the call to ack:

"Calls to acknowledge are ignored for both transacted sessions and sessions specified to use implicit acknowledgement modes. "

so.. what should we do on this case? 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221136#4221136

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221136



More information about the jboss-dev-forums mailing list