This content has been marked as final.
Show 3 replies
-
1. Re: Messages redelivered even if acked
jaikiran Oct 31, 2005 12:50 PM (in response to anre42)"anre42" wrote:
but I'v tried client-ack with not success, I've also tried m.acknowledge() in the IgnoreException block but that doesn't do any difference at all.
CLIENT_ACKNOWLEDGE is NOT meant for MDBs. Have a look at:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=70481 -
2. Re: Messages redelivered even if acked
anre42 Nov 1, 2005 4:32 AM (in response to anre42)Thanks for the reply, I now understand more about the different ack-modes. However, my problem still remains. In order to get more to get more control of all commits and rollbacks I tried BMT instead, with the following code structure
public void onMessage(Message m) { log.debug("Start onMessage()"); try { log.debug("Starting transaction"); context.getUserTransaction().begin(); } catch (Exception e) { log.error("Failed to start transaction"); } try { // do something that might fail } catch (HandledException he) { log.info("Caught HandledExcption, rolling back transaction") try { context.getUserTransaction().rollback(); } catch (Exception e) { log.error("Failed to rollback transasction " + e.toString()); } return; } catch (IgnoredException ie) { log.error("Caught IgnoredException, ignoring"); } log.debug("Commiting transaction"); try { context.getUserTransaction().commit(); } catch (Exception e) { log.error("Failed to commit transasction: " + e.toString()); } log.debug("End onMessage()"); }
And again, in the normal case, i.e. no exception is thrown it works ok and the transaction is commited. But if I provoke a IgnoreException the out put would be the following:
DEBUG Start onMessage()
DEBUG Starting transaction
ERROR Caught IgnoredException, ignoring
DEBUG Commiting transaction
ERROR Failed to commit transaction: javax.transaction.RollbackException: Already marked for rollback
Why would the transaction already be marked for rollback in this case? I'm thinking there might be some transaction timeout? In my case it's a quite long transaction, +1 min.
Does anyone have any idea on what might be going on here?
Tnx
/Andreas